Apache Tomcat proxied via Nginx

Tomcat support added. JSP and other filetypes now proxy through the Tomcat docker container. Also named each container so direct named access is possible.
This commit is contained in:
Marwolf
2018-07-26 23:23:12 -04:00
parent 0aed3a789b
commit d3172b4663
14 changed files with 5655 additions and 11 deletions

View File

@@ -4,6 +4,10 @@ server_tokens off;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
upstream dev_tomcat_1 {
server tomcat;
}
# Website and PHPBB forum over HTTP
server {
listen 80 default_server;
@@ -18,12 +22,31 @@ server {
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html/public;
index index.php index.html index.htm;
index index.php index.html index.htm index.jsp;
location ~ /\.ht {
deny all;
}
# Block empty folder access
location / {
try_files $uri $uri/ =404;
}
# Instructs visitor browser to cache files for 1 month
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 1M;
}
# Tomcat
location ~ \.(do|jspa|obr|jsp) {
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_pass http://tomcat:8082;
}
# PHPBB forum
location /board {
index index.php index.html index.htm;
try_files $uri $uri/ @rewriteapp;
@@ -36,8 +59,6 @@ server {
# Deny access to internal phpbb files.
location ~ /board(config\.php|common\.php|files|images/avatars/upload|includes|(?<!ext/)phpbb|store|vendor) {
deny all;
# deny was ignored before 0.8.40 for connections over IPv6.
# Use internal directive to prohibit access on older versions.
internal;
}
@@ -52,7 +73,7 @@ server {
fastcgi_param PATH_INFO $fastcgi_path_info;
}
# Correctly pass scripts for installer
# Correctly pass scripts for PHPBB installer usage
location /install/ {
try_files $uri $uri/ @rewrite_installapp;

View File

@@ -4,6 +4,10 @@ server_tokens off;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
upstream dev_tomcat_1 {
server tomcat;
}
# Website and PHPBB forum over HTTP
server {
listen 80 default_server;
@@ -18,12 +22,31 @@ server {
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html/public;
index index.php index.html index.htm;
index index.php index.html index.htm index.jsp;
location ~ /\.ht {
deny all;
}
# Block empty folder access
location / {
try_files $uri $uri/ =404;
}
# Instructs visitor browser to cache files for 1 month
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 1M;
}
# Tomcat
location ~ \.(do|jspa|obr|jsp) {
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_pass http://tomcat:8082;
}
# PHPBB forum
location /board {
index index.php index.html index.htm;
try_files $uri $uri/ @rewriteapp;
@@ -36,8 +59,6 @@ server {
# Deny access to internal phpbb files.
location ~ /board(config\.php|common\.php|files|images/avatars/upload|includes|(?<!ext/)phpbb|store|vendor) {
deny all;
# deny was ignored before 0.8.40 for connections over IPv6.
# Use internal directive to prohibit access on older versions.
internal;
}
@@ -52,7 +73,7 @@ server {
fastcgi_param PATH_INFO $fastcgi_path_info;
}
# Correctly pass scripts for installer
# Correctly pass scripts for PHPBB installer usage
location /install/ {
try_files $uri $uri/ @rewrite_installapp;