我在location中配置root,浏览器访问无效。搜了一天没找到答案,哪位大侠能告诉我为什么吗?
server {
listen 80;
server_name localhost;
#root /usr/share/nginx/html/project/manage/public; 路径写在这里有效,写道location中无效,没搞懂!!!!
location / {
root /usr/share/nginx/html/project/manage/public;
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ \.php(.*)$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
浏览器访问被定位到/usr/share/nginx/html/