- NGINX
- Serve static files
- Serve maintenance page
- Control access via GeoIP tables
- Offer HTTPS protocol to clients (443)
- Maintain reverse proxy to Tomcat on HTTP
- TOMCAT
- Will hold deployed application
- Communicates on port 8080
For a reverse proxy we need to configure nginx:
nginx.conf
1 2 3 4 5 6 7 8 9 10 |
... http { ... # Tomcat upstream tomcat { server localhost:8080; } ... include /etc/nginx/conf.d/*.conf; |
site.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
server { ... location / { proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto https; proxy_set_header Authorization ""; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240; proxy_pass http://tomcat; } ... } |
Tomcat configuration more simple:
server.xml
1 2 3 4 5 6 7 |
... <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" proxyPort="443" /> ... |