Reputation: 55
I'm trying to use NGINX to reverse proxy various internal apps/sites/services and have been able to get some to work while others are not working.
So for example I am adding some code below. The first reverse proxy for guacamole works without any problems.
The second reverse proxy for Muximux displays the content without proper formatting. Not sure why?
The third setting gives a 404/not found error.
#################################################
################### 10.10.1.2 ###################
#################################################
server {
listen 80;
# listen 80 default_server;
# listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name 10.10.1.2;
location / {
try_files $uri $uri/ =404;
}
location /guac {
proxy_pass http://10.10.1.3:8080/guacamole;
proxy_buffering off;
access_log off;
tcp_nodelay on;
tcp_nopush off;
sendfile on;
client_body_buffer_size 10K;
#client_header_buffer_size 1k;
client_max_body_size 8m;
#large_client_header_buffers 2 1k;
client_body_timeout 12;
#client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /muximux {
proxy_pass http://10.10.1.10/mux/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /localserve {
proxy_pass http://10.10.1.10;
}
}
Any help and guidance as to what could be wrong would be greatly appreciated.
Thanks
Upvotes: 3
Views: 1936
Reputation: 49672
A reverse proxy to multiple applications within a single server block by placing them in separate subfolders is achievable.
However, each application must know that it is hosted within a subfolder.
The page returned by an application contains URLs pointing to the resource files and page links. Generally, these URLs (which are created by the application) must also be prefixed by the subfolder, otherwise they will not pass through the reverse proxy correctly and result in pages displayed without the correct formatting.
Some applications are not designed to run in a subfolder, whereas others need little or no adjustment. You will need to investigate the configuration of each of your applications and look for a configuration item to set the base URL.
Upvotes: 2