After installation, directly access http://localhost/Symfony/web/app_dev.... The welcome page will appear, but a prompt will pop up
An error occurred while loading the web debug toolbar (404: Not Found).Do you want to open the profiler?
But accessing http://localhost/Symfony/web/app_dev.... and http://localhost/Symfony/web/app_dev.... will return 404, please solve
symfony2
ringa_lee2017-05-16 16:47:20
The problem has been solved because nginx does not know the pathinfo mode by default. Just configure it.
给我你的怀抱2017-05-16 16:47:20
The answer may be incorrect, I'm very sorry, you need to verify it
Open Nginx configuration file nginx.conf
Add the following configuration to the server:
^/(app|app_dev|config)\.php(/|$)
fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; set $real_script_name $fastcgi_script_name; set $path_info ””; if ( $fastcgi_script_name ~ “^(.+?.php)(/.+)$”) { set $real_script_name ; set $path_info ; } fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; }
location ~ .php { root /www/; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9090; fastcgi_index index.php; include fastcgi_params; set $real_script_name $fastcgi_script_name; set $path_info ””; if ( $fastcgi_script_name ~ “^(.+?.php)(/.+)$”) { set $real_script_name ; set $path_info ; } fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; }
After modification, pathinfo can be recognized, but symfony still reports an error. Not solved yet.
怪我咯2017-05-16 16:47:20
Looks like it’s time to expand your skills~ Level 4 and 6 are guaranteed, hahaha
server {
listen 80;
server_name 192.168.1.120;
root /data/nginx/htdocs/cwz;
location / {
index index.php index.html;
root /data/nginx/htdocs/cwz;
}
index app.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /app_dev.php/;
}
location ~ \.php(/|$) {
# try_files $uri =404;
fastcgi_index app_dev.php;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
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;
include fastcgi_params;
}
}