Welcome! Log In Create A New Profile

Advanced

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

February 18, 2020 04:53AM
I installed gitlab in behind nginx reverse proxy and it worked fine. Added the below configuration. Note that location path was changed.

upstream gitlab-workhorse {
server unix:/var/opt/gitlab/gitlab-workhorse/socket;
}

server {
listen 0.0.0.0:80 default_server;
listen [::]:80 default_server;
server_name abcd.com;
server_tokens off;
root /opt/gitlab/embedded/service/gitlab-rails/public;
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log debug;

location /gitlab {
client_max_body_size 0;
gzip off;
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;
}
}
While testing gitlab, I deleted default file soft link from nginx sites-enabled.

I created the soft link again the configuration is as follows: Note that default_server is removed her and location path is "/"

server {
listen 0.0.0.0:80;
listen [::]:80;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
access_log /var/log/nginx/default_access.log;
error_log /var/log/nginx/default_error.log debug;
location / {
try_files $uri $uri/ =404;
}
}

Now while accessing my VM ip http://x.y.z.a, I am getting "403 Forbidden" error in the browser. However gitlab still working. How to get both the sites working listening on port 80 but with different context of location?
Subject Author Posted

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

svgkraju February 18, 2020 04:53AM

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

Reinis Rozitis February 18, 2020 06:18AM

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

svgkraju February 18, 2020 05:22PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 138
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready