V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
kstsca
V2EX  ›  程序员

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

  •  
  •   kstsca · 2013-12-07 21:42:38 +08:00 · 3905 次点击
    这是一个创建于 3786 天前的主题,其中的信息可能已经有所发展或是发生改变。
    5 条回复    1970-01-01 08:00:00 +08:00
    LazyZhu
        1
    LazyZhu  
       2013-12-07 21:58:05 +08:00
    情节会如此发展:
    楼下:肯定支持。
    楼主:我怎么绑定不来哦。
    楼下:提示什么错误?
    楼主:“xxx error”
    楼下:你有没有干什么?
    楼主:我xxx
    ......

    我的答案是:建议楼主去看《提问的艺术》,为大家节约时间。
    xujialiang
        2
    xujialiang  
       2013-12-07 21:59:17 +08:00 via Android
    楼上威武←_←
    kstsca
        3
    kstsca  
    OP
       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
        4
    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
        5
    icanc  
       2013-12-08 08:19:50 +08:00
    试试 root /usr/local/nginx/html/www/sxx\.net;
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2691 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 10:18 · PVG 18:18 · LAX 03:18 · JFK 06:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.