Last active
June 21, 2016 18:32
-
-
Save igorrendulic/2f49ec2eececa316ce6e4f3ee3a3bc07 to your computer and use it in GitHub Desktop.
Nginx reverse proxy config for Tomcat7 on Debian and 413 File too Large problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tomcat7 add to config: | |
<Host name="localhost" appBase="webapps" | |
unpackWARs="true" autoDeploy="true"> | |
<Context path="" docBase="administracija"> | |
<WatchedResource>WEB-INF/web.xml</WatchedResource> | |
</Context> | |
<!-- SingleSignOn valve, share authentication between web applications | |
Documentation at: /docs/config/valve.html --> | |
<!-- | |
<Valve className="org.apache.catalina.authenticator.SingleSignOn" /> | |
--> | |
<!-- Access log processes all example. | |
Documentation at: /docs/config/valve.html | |
Note: The pattern used is equivalent to using pattern="common" --> | |
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" | |
prefix="localhost_access_log." suffix=".txt" | |
pattern="%h %l %u %t "%r" %s %b" /> | |
</Host> | |
NginX edit file: /etc/nginx/sites-enabled/default | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /var/lib/tomcat7/webapps/administracija; | |
# Add index.php to the list if you are using PHP | |
index index.html index.htm index.nginx-debian.html; | |
server_name _; | |
location / { | |
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://127.0.0.1:8080; | |
} | |
} | |
To enable larger files (deploying over tomcat7-admin) - preventing exception: 413 Request Entity Too Large | |
edit file: /etc/nginx/nginx.conf | |
Add to http section: client_max_body_size 100M; | |
restart: service nginx reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment