Reverse proxy to Tomcat 8
Dino Edwards
dino.edwards at mydirectmail.net
Sat Jul 18 13:18:22 UTC 2020
Trying to reverse proxy using Nginx to a tomcat 8 application listening on port 8443 but I'm running into an issue where I'm getting status 404 on all static content.
Below is my config file. The /admin location works with no problems. The /ciphermail is the problematic one. I had the exact same problem with static content with the /admin location until I added the following in my server block:
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$
and then it started working. However, the /ciphermail location seems to still not work.
server {
#LISTEN CONFIG
listen 80 default_server;
listen [::]:80 default_server;
#REDIRECT TO HTTPS UNCOMMENT BELOW TO ENABLE
#return 301 https://$host$request_uri;
keepalive_timeout 70;
#LOGS CONFIG
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
proxy_max_temp_file_size 5120m;
client_max_body_size 5120m;
# Set the .well-known directory alias for initial Lets Encrypt Certificate
location /.well-known {
root /var/www/html/;
}
root /var/www/html;
index index.cfm index.html index.htm;
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 1y;
}
location /admin {
#Set Real IP Headers
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_redirect off;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_pass http://localhost:8888/admin/;
}
location /ciphermail {
#Set Real IP Headers
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_redirect off;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_ssl_verify off;
proxy_pass https://localhost:8443/ciphermail/;
}
}
More information about the nginx
mailing list