Well, I’ve been tinkering with NGINX for a while at home, up till now I had a somewhat working reverse proxy setup (to access my stuff, when I’m not at home or away).
What didn’t work so far was the DSM web interface. Basically, because the interface is using absolute paths in some CSS/JS includes, which fuck up the whole interface.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<link rel="stylesheet" type="text/css" href="/scripts/ext-3/resources/css/ext-all.css?v=3211" /> <link rel="stylesheet" type="text/css" href="/scripts/ext-3/resources/css/xtheme-gray.css?v=3211" /> <link rel="stylesheet" type="text/css" href="/scripts/ext-3/ux/ux-all.css?v=3211" /> <link rel="stylesheet" type="text/css" href="resources/css/desktop.css?v=3211" /> <link rel="stylesheet" type="text/css" href="resources/css/flexcrollstyles.css?v=3211" /> ... <script type="text/javascript" src="/scripts/uistrings.cgi?lang=enu&v=3211"></script> <script type="text/javascript" src="/webfm/webUI/uistrings.cgi?lang=enu&v=3211"></script> <script type="text/javascript" src="uistrings.cgi?lang=enu&v=3211"></script> <script type="text/javascript" src="/scripts/prototype-1.6.1/prototype.js?v=3211"></script> <script type="text/javascript" src="/scripts/ext-3/adapter/ext/ext-base.js?v=3211"></script> <script type="text/javascript" src="/scripts/ext-3/ext-all.js?v=3211"></script> <script type="text/javascript" src="/scripts/ext-3/ux/ux-all.js?v=3211"></script> <script type="text/javascript" src="/scripts/scrollbar/flexcroll.js?v=3211"></script> |
After some googling and looking through the NGINX documentation I thought “Why don’t I create a vHost for each application that is being served by the reverse proxy?”.
And after looking further into the documentation, out came this simple reverse proxy statement:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
server { listen 80; server_name syno.heimdaheim.de; location / { proxy_pass http://172.31.76.50:5000/; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_redirect http://172.31.76.50:5000/ http://$host:$server_port/; proxy_buffering off; auth_basic "Restricted"; auth_basic_user_file /etc/nginx/htpasswd; } } |
And as you can see, it works: