安裝好後,直接造訪http://localhost/Symfony/web/app_dev.... 會出現welcome頁面,但會彈出一個提示
An error occurred while loading the web debug toolbar (404: Not Found).Do you want to open the profiler?
但這樣訪問 http://localhost/Symfony/web/app_dev.... 與 http://localhost/Symfony/web/app_dev.... 都會回傳404,求解
symfony2
给我你的怀抱2017-05-16 16:47:20
答案可能不正確,非常抱歉,還需要驗證一下
開啟Nginx的設定檔nginx.conf
在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; }
修改以後以後可以辨識pathinfo但是symfony 還是報錯。暫時沒解決。
怪我咯2017-05-16 16:47:20
看來是時候放大招了~ 四六級包過啊 哈哈哈
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;
}
}