configuration - 在 nginx 上设置子域?

标签 configuration nginx subdomain

关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。












想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。

6年前关闭。



Improve this question




我正在尝试在 nginx 上设置一个子域。我的设置是在端口 8080 上运行并使用来自 nginx 的代理的 Pylons 应用程序。

我试图让子域工作的原因是最终设置开发和登台服务器。

这是我的 nginx.conf 文件:

worker_processes  2;

events {
    worker_connections  1024;
}


http {
    include     mime.types;
    default_type    application/octet-stream;
    access_log  logs/rentfox.access.log;
    error_log   logs/rentfox.error.log;
    gzip        on;
    sendfile    on;
    tcp_nopush  on;
    tcp_nodelay on;
    keepalive_timeout   75 20;

    server {
        listen       80;
        server_name  xxx.net;

        location / {            
            include /usr/local/nginx/conf/proxy.conf;
            proxy_pass http://127.0.0.1:8080;
            proxy_redirect default;
            root /var/apps/xxx/xxx/public/;
        }

        #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;
        }

    }
    server {
        listen       80;
        server_name  dev.xxx.net;

        location / {            
            include /usr/local/nginx/conf/proxy.conf;
            proxy_pass http://127.0.0.1:8080;
            proxy_redirect default;
            root /var/apps/xxx/xxx/public/;
        }

        #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;
        }

    }

}

提前致谢!

最佳答案

我可以看到 xxx.net 和 www.xxx.net 域,但是当我尝试 dev.rentfox.net 域时找不到服务器 - 您是否使用通配符或 dev 子域设置了 DNS 记录?

如果 DNS 设置正确,当您访问 dev 子域时,来自 nginx 的访问和错误日​​志是什么样的?

关于configuration - 在 nginx 上设置子域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1174554/

相关文章:

configuration - 如何在 Windows ClearCase 中使用 ediff (emacs diff) 作为差异/合并工具?

c# - IConfiguration 不包含 GetValue 的定义

php - PHP 5.5 的 Ioncube 难度

ruby-on-rails - Rails 将协议(protocol)设置为始终 HTTP

asp.net-mvc - MVC 路由到子域

ruby - 从 ruby​​ 中的字符串中删除子域

apache - 将子域重定向到文件而不硬编码 url

.net - Settings 和 *.config 之间有什么区别?

linux - 在 Linux 中注册可由启动和停止命令控制的守护进程

php - nginx + php-fpm = 找不到文件