nginx root 目录绑定不支持 html/www/www.aa.com ???

2013-12-07 21:42:38 +08:00
 kstsca
3960 次点击
所在节点    程序员
5 条回复
LazyZhu
2013-12-07 21:58:05 +08:00
情节会如此发展:
楼下:肯定支持。
楼主:我怎么绑定不来哦。
楼下:提示什么错误?
楼主:“xxx error”
楼下:你有没有干什么?
楼主:我xxx
......

我的答案是:建议楼主去看《提问的艺术》,为大家节约时间。
xujialiang
2013-12-07 21:59:17 +08:00
楼上威武←_←
kstsca
2013-12-07 22:09:06 +08:00
server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root /usr/local/nginx/html/www/sxx.net;
index index.html index.htm index.php;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


提示 File not found.

我把sxx.net 目录 换成 sxxnet 就可以,但文件名sxx.net不支持,感觉是没定位到那个目录。
richardevs
2013-12-07 22:34:38 +08:00
@kstsca root是server block的屬性而不應擺在location block下面...

server {
listen 80;
server_name localhost;
root /usr/local/nginx/html/www/sxx.net;
index index.html index.htm index.php;
icanc
2013-12-08 08:19:50 +08:00
试试 root /usr/local/nginx/html/www/sxx\.net;

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/92214

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX