I'm having this strange issue. I have a local network running a server with my gitlab instance and some webpages. The configuration of my reverse proxy is following:
server {
server_name my.website.com;
location / {
proxy_pass http://127.0.0.1:8086;
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;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/my.website.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/my.website.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = my.website.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name my.website.com;
return 404; # managed by Certbot
}
server {
listen 80;
server_name service1.website.com;
root /var/www/service1;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.4-fpm.sock; # Adjust this to your PHP-FPM socket path/version
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
server {
listen 80;
server_name api.website.com;
root /var/www/api;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.4-fpm.sock; # Adjust this to your PHP-FPM socket
path/version
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
I have censored the actual URLs, but the rest stays the same.
I have respective ports opened on my router so the websites and services are accessible from the outside. However if I try to connect to the same URL from the local network the server is running on, I'm getting timeout all the time. The only way to get anything else is to directly type in the IP and port and then I'm getting at least an SSL error, but I know this isn't the right way to do so.
What I need is to setup my reverse proxy to also allow connections from localhost the same way it allows it from the outside network.
I've looked at the nginx config, but I don't see any potential issue with the config. Also I have looked at the /etc/hosts file and firewall settings, but couldn't find anything that would look suspicious.
I'd appreciate any help, thank you.
EDIT: I've looked on whether my router supports NAT loopback and indeed it does. I can even ping to the URL of the server, but every connection ends with a timeout.