Two sites listening on same port simultaneously with different location (context) not workig

svgkraju nginx-forum at forum.nginx.org
Tue Feb 18 22:22:37 UTC 2020


Thank you for your suggestion. I changed gitlab as follows and removed
default from sites-enabled. This worked.

server {
  listen 0.0.0.0:80 default_server;
  listen [::]:80 default_server;
  server_name abcd.com; ## Replace this with something like
gitlab.example.com
  server_tokens off; ## Don't show the nginx version number, a security best
practice
  root /var/www/html;

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

  location / {
    try_files $uri $uri/ =404;
  }

  location /gitlab {
    client_max_body_size 0;
    gzip off;
    root /opt/gitlab/embedded/service/gitlab-rails/public;

    proxy_read_timeout      300;
    proxy_connect_timeout   300;
    proxy_redirect          off;
    proxy_http_version 1.1;

    proxy_set_header    Host                $http_host;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto   $scheme;

    proxy_pass http://gitlab-workhorse;
  }
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,287036,287051#msg-287051



More information about the nginx mailing list