...
Install nginx (this is OS and distribution-specific step) - Details on how to install Nginx can be found at http://wiki.nginx.org/Install
Make sure that Tomcat accepts HTTP requests from localhost (by default on 8080 port)
In order to web application resolve client IP address, protocol, you need to add the following:
Code Block language html/xml <Valve className="org.apache.catalina.valves.RemoteIpValve" protocolHeader="X-Forwarded-Proto" protocolHeaderHttpsValue="https" /> in server.xml (remove 'protocolHeaderHttpsValue' attribute in case of non-SSL setup)
Configure /etc/nginx/conf.d/default.conf (default directory of included config files for CentOS nginx installation):
Code Block |
---|
Server { listen 80; server_name portal.example.com www.portal.example.com; charset utf-8; location / { proxy_pass http://localhost:8080; # Next headers are required in order to allow tomcat to resolve client address (not proxy) # In ${tomcat}/conf/server.xml add this line: # <Valve className="org.apache.catalina.valves.RemoteIpValve protocolHeader="X-Forwarded-Proto" protocolHeaderHttpsValue="https" /> proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_buffer_size 8k; proxy_buffers 16 32k; proxy_busy_buffers_size 64k; } location ~ /(WEB-INF|META-INF) { deny all; } } |
...
Code Block | ||
---|---|---|
| ||
#! /bin/bash
# Schedule this script using contab expression:
# 55 0 * * * /home/tomcat/create_gz_files.sh >> /dev/null 2>&1
FILETYPES="*.css *.jpg *.jpeg *.gif *.png *.js *.html"
# specify a list of directories to check recursively
DIRECTORIES="/directory/to/compress/*/another/directory/to/compress/*"
for currentdir in $DIRECTORIES
do
for extension in $FILETYPES
do
#echo $currentdir
find $currentdir -iname $extension -exec bash -c 'PLAINFILE={};GZIPPEDFILE={}.gz;
if [ -e $GZIPPEDFILE ];
then if [ `stat --printf=%Y $PLAINFILE` -gt `stat --printf=%Y $GZIPPEDFILE`];
then echo "$GZIPPEDFILE outdated, regenerating";
gzip -9 -f -c $PLAINFILE > $GZIPPEDFILE;
touch -r $PLAINFILE $GZIPPEDFILE ;
fi;
else echo "$GZIPPEDFILE is missing, creating it";
gzip -9 -c $PLAINFILE > $GZIPPEDFILE;
touch -r $PLAINFILE $GZIPPEDFILE ;
fi';
done
done |
Warning | ||||
---|---|---|---|---|
| ||||
Please send us feedback at uportal-user@lists.ja-sig.org |