I have several web apps I like to proxy with a single URL. This is my nginx.conf
server {
listen 443 ssl;
server_name webapps.mysite.com 192.168.5.28;
access_log /var/log/nginx/webapps_access.log;
error_log /var/log/nginx/webapps_errors.log;
ssl_certificate /etc/letsencrypt/live/webapps.mysite.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/webapps.mysite.com/privkey.pem; # managed by Certbot
location /casaos {
proxy_pass http://192.168.5.165:81;
proxy_intercept_errors on;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
# access_log off;
}
location /guacamole/ {
proxy_pass http://192.168.5.44:8080;
proxy_intercept_errors on;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
# access_log off;
}
location /apps {
# The following configurations must be configured when proxying to Kasm Workspaces
# WebSocket Support
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Host and X headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Connectivity Options
proxy_http_version 1.1;
proxy_read_timeout 1800s;
proxy_send_timeout 1800s;
proxy_connect_timeout 1800s;
proxy_buffering off;
proxy_intercept_errors on;
# Allow large requests to support file uploads to sessions
client_max_body_size 10M;
# Proxy to Kasm Workspaces running locally on 8443 using ssl
proxy_pass https://192.168.5.40;
}
}
If I use the ip's of the webapps they work;
HTTP://192.168.5.165:81
HTTP://192.168.4.44:8080
HTTP://192.168.5.40
but in my site config, only site that works is the guacamole app works.
HTTP://webapps.mysite.com/guacamole/
The other gives me a 404.
HTTP://webapps.mysite.com/apps
HTTP://webapps.mysite.com/casaos
How can I troubleshoot why I am getting 404? The logs are giving me nothing either, I only my tries accessing my site
One more thing, if I only proxy only one web as a /, they work.
location / {
proxy_pass http://192.168.5.165:81;
proxy_intercept_errors on;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
# access_log off;
}
So this again is bugging me that I can host multi-web apps.