简体   繁体   中英

Server configuration file for nginx

I'm trying to install Symfony on my php5-fpm+nginx server on ubuntu.

When i'm entering to /web/app_dev.php it's displaying an error :

An error occurred while loading the web debug toolbar (404: Not Found).

Do you want to open the profiler?

When i'm entering to profiler(/web/app_dev.php/_profiler/0db7ac) it tells:

No input file specified.

I know there is a problem with my server configuration file. Here it is:

 server {

            listen   80;

           # listen   [::]:80 ipv6only=on;

            root /home/marker/Projects/stereoshoots/www;

            access_log  /home/marker/Projects/stereoshoots/logs/access.log;

            server_name stereoshoots.local;

            index index.php index.html index.htm;





            location / {

                    autoindex  on;

    #                try_files $uri $uri/ @rewrite;

                    try_files $uri $uri/ /index.php;

            }

    #        location @rewrite {

    #                rewrite ^/(.*)$ /index.php?q=$1;

    #        }

            location ~* \.(jpg|jpeg|gif|css|png|js|ico|xml|txt)$ {

                access_log        off;

                expires           30d;

            }

            location = /favicon.ico {

                    return 204;

                    access_log     off;

                    log_not_found  off;

            }

            location ~ \.php$ {

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

                    fastcgi_index index.php;

                    include fastcgi_params;

            }

            location ~ /\.ht {

                    deny all;

            }



    }

What should i edit, to get symfony installed right?

Thanks!

我认为剩下的唯一事情就是将uri传递给index.php

try_files $uri $uri/ /index.php$request_uri

Do you really have index.php?

Try this:

index app_dev.php;

try_files $uri $uri/ @rewrite;

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

location ~ \.php {

    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_param SERVER_PORT 80;
    fastcgi_param SERVER_NAME stereoshoots.local;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index app_dev.php; 
}

Notice that I changed location ~ \\.php$ to location ~ \\.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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