Nginx配置在RHEL 6.3版本中不起作用

Nginx配置在RHEL 6.3版本中不起作用,nginx,configuration,phalcon,Nginx,Configuration,Phalcon,我正在使用Red Hat Enterprise server托管基于phalcon的应用程序。但部署后,应用程序不工作,并显示“请在web服务器上启用重写模块以继续”。我在default.conf文件中使用以下配置 如果有人有任何想法,请帮助我解决这个问题 server { listen 80; server_name example.com www.example.com; access_log /srv/www/example.com/log/access

我正在使用Red Hat Enterprise server托管基于phalcon的应用程序。但部署后,应用程序不工作,并显示“请在web服务器上启用重写模块以继续”。我在default.conf文件中使用以下配置

如果有人有任何想法,请帮助我解决这个问题

server {
    listen      80;
    server_name example.com www.example.com;

    access_log /srv/www/example.com/log/access.log;
    error_log /srv/www/example.com/log/error.log;

    root /srv/www/example.com/public/;
    index index.html index.htm index.php;

    location / {
        try_files $uri $uri/ @php_mvc;
    }

    location @php_mvc {
        rewrite ^(.+)$ /index.php$1 last;
    }

    location ~ ^(.+\.php)(/.*)?$ {
        fastcgi_split_path_info ^(.+\.php)(/.*)?$;

        set $script_filename $document_root$fastcgi_script_name;

        if (!-e $script_filename) {
            return 404;
        }

        fastcgi_pass fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;

        fastcgi_param   APPLICATION_ENV development;
        fastcgi_param   SCRIPT_FILENAME $script_filename;
        fastcgi_param   SCRIPT_NAME $fastcgi_script_name;
        fastcgi_param   PATH_INFO $fastcgi_path_info;
    }
}

请尝试在nginx配置中添加以下代码并再次检查

try_files $uri $uri/ @rewrite;

    location @rewrite {
        rewrite ^/(.*)$ /index.php?_url=$1;
    }   
这对你有用。(超时时间很高,您应该根据应用程序规格进行更改)


Boss可以为RHEL 6.3共享完整的配置脚本,上面的代码不起作用。提前谢谢。
server {
    listen   80 default_server;
    server_name  _;
    client_max_body_size 128M;
    location / {
        root /var/www/public;
        index  index.php index.html index.htm;
        try_files $uri $uri/ @rewrite;
        fastcgi_connect_timeout 3000;
        fastcgi_send_timeout 3000;
        fastcgi_read_timeout 3000;
        client_max_body_size 128M;
        proxy_read_timeout 3000;
    }
    location @rewrite {
        rewrite ^/(.*)$ /index.php?_url=$uri&$args;
    }
    error_page  404              /404.html;
    location = /404.html {
        root   /usr/share/nginx/html;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
    location ~ \.php$ {
        root /var/www/public;
        try_files $uri =404;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
        include        fastcgi_params;
    }
    location ~ "\.(js|ico|gif|jpg|png|jpeg|xls|csv)$" {
        root /var/www/public;
    }
    location ~*  \.(jpg|jpeg|png|gif|ico)$ {
        expires 365d;
        log_not_found off;
        access_log off;
    }
}