Php nginx路由错误404上的Laravel 4.1
我在nginx服务器上的laravel路由有问题。 除默认路由外,所有路由均未找到404,与此问题非常相似: 这个问题的解决办法是:Php nginx路由错误404上的Laravel 4.1,php,laravel,nginx,http-status-code-404,Php,Laravel,Nginx,Http Status Code 404,我在nginx服务器上的laravel路由有问题。 除默认路由外,所有路由均未找到404,与此问题非常相似: 这个问题的解决办法是: server { listen 80; server_name sub.domain.com; set $root_path '/srv/www/htdocs/application_name/public'; root $root_path; index index.php index.html index.htm;
server {
listen 80;
server_name sub.domain.com;
set $root_path '/srv/www/htdocs/application_name/public';
root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
include /etc/nginx/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;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
它工作得很好,唯一的问题是我需要根路径为/srv/www/htdocs,因为我还有其他项目在那里运行。
每当我换行时:
set $root_path '/srv/www/htdocs/application_name/public';
致:
问题从url开始,比如:localhost/application\u name/public/users
set $root_path '/srv/www/htdocs';