简体   繁体   English

Symfony2 Nginx问题-找不到所有页面404

[英]Symfony2 nginx issue - all pages 404 not found

I've got problem with my project in symfony2 when i'm trying to run this on nginx. 当我尝试在nginx上运行时,我在symfony2中的项目遇到问题。

www.domain/ works fine www.domain /工作正常

www.domain/app_dev.php ,"An error occurred while loading the web debug toolbar (404: Not Found).Do you want to open the profiler?" www.domain / app_dev.php,“加载Web调试工具栏时发生错误(404:未找到)。是否要打开探查器?”

www.domain/app.php/someurl/ - 404 not found www.domain / app.php / someurl /-找不到404

Is it server configuration issue or should I change my .htaccess in some way to make it possible to run with nginx? 是服务器配置问题,还是应该以某种方式更改.htaccess使其可以与nginx一起运行?

You can check my dev config (with PHP-FPM): 您可以检查我的开发配置(使用PHP-FPM):

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

    root /var/www/web;

    access_log /var/log/nginx/access.log;
    error_log  /var/log/nginx/error.log error;

    index app.php index.html index.htm;

    try_files $uri $uri/ @rewrite;

    location @rewrite {
        rewrite ^/(.*)$ /app.php/$1;
    }

    location ~ \.php(/|$) {
        # try_files $uri =404;

        fastcgi_index app.php;
        fastcgi_pass unix:/var/run/php5-fpm.sock;

        include fastcgi_params;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_buffer_size   1280k;
        fastcgi_buffers   4 2560k;
        fastcgi_busy_buffers_size   2560k;
    }

    location ~ /\.ht {
        deny all;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM