The original post: /r/nginx by /u/fitim92 on 2024-06-26 14:41:32.
I am really new in this topic.
What i want to achieve: I have different tools that i use on my synology.
Instead of connecting to all of the different tools with subdomains I want to use one domain with subfolders, like this:
- Mainpage: domain.xy - running on 54001
- App1: domain.xy/app1 - running on 810
- App2: domain.xy/app2 - running on 8044 etc. Is this even possible? From what I found: yes. But somehow it isnt working.
FYI: I forwarded 443 and 80 to Nginx, nothing else. Is this correct?
This i my config file:
# ------------------------------------------------------------
# domain.duckdns.org
# ------------------------------------------------------------
map $scheme $hsts_header {
https "max-age=63072000; preload";
}
server {
set $forward_scheme https;
set $server "192.168.178.40";
set $port 54001;
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
server_name domain.duckdns.org;
# Let's Encrypt SSL
include conf.d/include/letsencrypt-acme-challenge.conf;
include conf.d/include/ssl-ciphers.conf;
ssl_certificate /etc/letsencrypt/live/npm-6/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/npm-6/privkey.pem;
# Force SSL
include conf.d/include/force-ssl.conf;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
access_log /data/logs/proxy-host-1_access.log proxy;
error_log /data/logs/proxy-host-1_error.log warn;
location /npm {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://nginx-proxy-manager-app-1:81;
# Force SSL
include conf.d/include/force-ssl.conf;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
}
location /test {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8044;
# Force SSL
include conf.d/include/force-ssl.conf;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
}
location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
# Proxy!
include conf.d/include/proxy.conf;
}
# Custom
include /data/nginx/custom/server_proxy[.]conf;
}
I tried different formatting, like location /npm/ { etc. but its not working. I always get 502 Bad Gateway openresty.
You must log in or register to comment.