laravel nginx下配置出现404
我的nginx,这样配置,
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name yuming.com;
location / {
root /usr/local/nginx/html/laravel/public/;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php$ {
root /usr/local/nginx/html/laravel/public/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
}
是没有任何问题的,可以正常访问
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name yuming.com;
location /juweb/ {
root /usr/local/nginx/html/laravel/public/;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php$ {
root /usr/local/nginx/html/laravel/public/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
}
加了 /juweb/
访问就会出现NotFoundHttpException in RouteCollection.php line 161:
这样的问题,有人遇到过吗,请解答写,在此多谢啦
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name yuming.com;
location / {
root /usr/local/nginx/html/laravel/public/;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php$ {
root /usr/local/nginx/html/laravel/public/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
}
是没有任何问题的,可以正常访问
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name yuming.com;
location /juweb/ {
root /usr/local/nginx/html/laravel/public/;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php$ {
root /usr/local/nginx/html/laravel/public/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
}
加了 /juweb/
访问就会出现NotFoundHttpException in RouteCollection.php line 161:
这样的问题,有人遇到过吗,请解答写,在此多谢啦
2 个回复
whd - 专注php开发
赞同来自:
listen 80;
server_name '域名';
set $root_path '/phpstudy/www/laravel/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;
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;
include fastcgi_params;
client_max_body_size 30m;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /.ht {
deny all;
}
}
whd - 专注php开发
赞同来自: