大神門,我的伺服器是centos7+nginx+laravel5,現在的問題是我的配置好後只能訪問Index控制器,無法訪問其他的文件,然後提示404錯誤。誰有經驗或知道怎麼修改?請幫忙講解一下。不勝感激。
#下面是我這裡的ngxin配置,大神門看看要是覺得哪裡不對的幫忙指出來,最後能說說怎麼修改比較好,先謝謝啦。
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
server_name 101.200.76.215;
root /var/www/phpmoo_online/phpmoo_blog/public;
index index.php index.html index.htm;
charset utf-8;
location / {
index index.php
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
root /var/www/phpmoo_online/phpmoo_blog/public;
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /var/www/phpmoo_online/phpmoo_blog/public$fastcgi_script_name;
include fastcgi_params;
}
}
}
目測位址重寫有問題,路由沒法正確解析參數。