Nginx Reverse proxy - Public apps links

Please post your questions about using the web-based Photo, Music, Video Stations here.
Post Reply
epbeugel
New here
Posts: 6
Joined: Sun Apr 19, 2009 10:39 pm

Nginx Reverse proxy - Public apps links

Post by epbeugel »

Hi all,

I have the following setup:
Qnap TS-470 pro with Nginx installed as a reverse proxy.
This setup allows us to only open port 80 and 443 to access the nas from the internet
via its Fully qualified domain name. (nas..exampledomain.com)

I run several websites and applications like SabNzbd, Couchpotato, Sickbeard etc...
My nginx config allows me to access them via sabnzbd.exampledomain.com or couchpotato.exampledomain.com etc... without using their portnumbers.

I've installed the applications via the app center.

Some applications have the possibility to show them in the 'Public apps' section on the login screen.

--However these links do not work in my config because the links in the login screen still contain the portnumber on which they listen.
Is their a possiblity to change this?

-- Also when we share a photo or music file the links contain either the internal IP address of the nas or our external IP address.
We would like the use our FQDN their as well.

Does anyone have any suggestions?

Best regards, Epbeugel
lrem
Starting out
Posts: 21
Joined: Wed Mar 27, 2013 7:44 pm

Re: Nginx Reverse proxy - Public apps links

Post by lrem »

Any chance you can share your ngnix config please?
epbeugel
New here
Posts: 6
Joined: Sun Apr 19, 2009 10:39 pm

Re: Nginx Reverse proxy - Public apps links

Post by epbeugel »

Hi,

this is my Nginx config.

user httpdusr everyone;
#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 8082;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

server {
listen 8082;
server_name troteccam.Example-Domain.com;
location / {
proxy_pass http://192.168.0.222;
proxy_redirect off;
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;
}
}

server {
listen 8082;
server_name sabnzbd.Example-Domain.com;
location / {
proxy_pass http://192.168.0.96:8800;
proxy_redirect off;
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;
}
}

server {
listen 8082;
server_name mars.Example-Domain.com;
location / {
proxy_pass http://192.168.0.96:8080;
proxy_redirect off;
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;
}
}

server {
listen 8082;
server_name joost.Example-Domain.com;
location / {
proxy_pass http://0.0.0.0:8080;
proxy_redirect off;
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;
}
}

server {
listen 8082;
server_name haiti.Example-Domain.com Example-Domain.com nte.it
http://www.nte.it http://www.Example-Domain.com webfiles.Example-Domain.com
blog.Example-Domain.com photos.Example-Domain.com phpmyadmin.Example-Domain.com
piwik.Example-Domain.com;
location / {
proxy_pass http://192.168.0.96:80;
proxy_redirect off;
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;
}
}

server {
listen 8082;
server_name transmission.Example-Domain.com;
location / {
proxy_pass http://192.168.0.96:9091;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

server {
listen 8082;
server_name tv.Example-Domain.com;
location / {
proxy_pass http://192.168.0.199;
# proxy_pass http://192.168.0.121;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

server {
listen 8082;
server_name irrigation.Example-Domain.com;
location / {
proxy_pass http://192.168.0.42;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
}
}

server {
listen 8082;
server_name net2ftp.Example-Domain.com;
location / {
proxy_pass http://192.168.0.96:80;
proxy_redirect off;
proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

server {
listen 8082;
server_name sickbeard.Example-Domain.com;
rewrite ^/sickbeard/(.*)$ /sickb/$1;
location /sickb {
proxy_pass http://192.168.0.96:7071/sickbeard/;
proxy_redirect off;
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;
}
}

server {
listen 8082;
server_name couchpotato.Example-Domain.com;
location / {
proxy_pass http://192.168.0.96:5050/;
proxy_redirect off;
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;
}
}

server {
listen 8082;
server_name security.Example-Domain.com;
location / {
proxy_pass http://192.168.0.221;
# proxy_redirect off;
# 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;
}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443;
# server_name localhost;

# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}
lrem
Starting out
Posts: 21
Joined: Wed Mar 27, 2013 7:44 pm

Re: Nginx Reverse proxy - Public apps links

Post by lrem »

Thanks for that. I have decided to stick with Apache just now though. The only thing I am reverse proxying is Plex
User avatar
Moogle Stiltzkin
Guru
Posts: 11448
Joined: Thu Dec 04, 2008 12:21 am
Location: Around the world....
Contact:

Re: Nginx Reverse proxy - Public apps links

Post by Moogle Stiltzkin »

i'm thinking of switching to nginx for my wordpress, but i am stuck on a few things.

1. will my qpkg apps break if i use nginx instead of apache ?
2. how do i move my wordpress site to the nginx qpkg ?
3. how do i setup the nginx config and htaccess rule equivalent to secure my site (and is there a wordpress plugin people use for that?)
NAS
[Main Server] QNAP TS-877 (QTS) w. 4tb [ 3x HGST Deskstar NAS & 1x WD RED NAS ] EXT4 Raid5 & 2 x m.2 SATA Samsung 850 Evo raid1 +16gb ddr4 Crucial+ QWA-AC2600 wireless+QXP PCIE
[Backup] QNAP TS-653A (Truenas Core) w. 4x 2TB Samsung F3 (HD203WI) RaidZ1 ZFS + 8gb ddr3 Crucial
[^] QNAP TL-D400S 2x 4TB WD Red Nas (WD40EFRX) 2x 4TB Seagate Ironwolf, Raid5
[^] QNAP TS-509 Pro w. 4x 1TB WD RE3 (WD1002FBYS) EXT4 Raid5
[^] QNAP TS-253D (Truenas Scale)
[Mobile NAS] TBS-453DX w. 2x Crucial MX500 500gb EXT4 raid1

Network
Qotom Pfsense|100mbps FTTH | Win11, Ryzen 5600X Desktop (1x2tb Crucial P50 Plus M.2 SSD, 1x 8tb seagate Ironwolf,1x 4tb HGST Ultrastar 7K4000)


Resources
[Review] Moogle's QNAP experience
[Review] Moogle's TS-877 review
https://www.patreon.com/mooglestiltzkin
Post Reply

Return to “Photo Station, Music Station, Video Station”