nginx将子域重定向到父域

时间:2017-10-20 06:17:13

标签: redirect nginx proxypass nginx-reverse-proxy

我正在尝试在subdomain.mydomain.com中设置GitLab。但是在调用此URL时,它会被重定向到www.mydomain.com。以下是我的/etc/nginx/sites-available/subdomain.mydomain.com文件。我遵循了link

upstream gitlab {
            server unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;
}

server {
    listen 80;
    server_name subdomain.mydomain.com;
    server_tokens off; 
    root /opt/gitlab/embedded/service/gitlab-rails/public;

    client_max_body_size 250m;

    access_log  /var/log/nginx/gitlab_access.log;
    error_log   /var/log/nginx/gitlab_error.log;

    location / {
        proxy_redirect off;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://gitlab;
    }
}

此配置有什么问题。

0 个答案:

没有答案