← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-documenters/dhis2/dhis2-docbook-docs] Rev 477: nginx update

 

------------------------------------------------------------
revno: 477
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2-docbook-docs
timestamp: Tue 2012-03-20 16:40:45 +0100
message:
  nginx update
modified:
  src/docbkx/en/dhis2_implementation_guide_installation.xml


--
lp:~dhis2-documenters/dhis2/dhis2-docbook-docs
https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs

Your team DHIS 2 developers is subscribed to branch lp:~dhis2-documenters/dhis2/dhis2-docbook-docs.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs/+edit-subscription
=== modified file 'src/docbkx/en/dhis2_implementation_guide_installation.xml'
--- src/docbkx/en/dhis2_implementation_guide_installation.xml	2012-03-15 11:02:56 +0000
+++ src/docbkx/en/dhis2_implementation_guide_installation.xml	2012-03-20 15:40:45 +0000
@@ -92,16 +92,16 @@
     <para><code>sudo /usr/local/nginx/sbin/nginx -s stop</code></para>
     <para>Now that we have installed nginx we will now continue to configure regular proxying of requests to our Tomcat instance, which we assume runs at <emphasis role="italic">http://localhost:8080</emphasis>. To configure nginx you can open the configuration file by invoking</para>
     <para><code>sudo nano /usr/local/nginx/conf/nginx.conf</code></para>
-    <para>nginx configuration is built around a hierarchy of blocks representing http, server and location, where each block inherit settings from parent blocks. The following snippet will configure nginx to proxy pass (redirect) requests from port 80 (which is the port nginx will listen on by default) to our Tomcat instance. It will also make nginx serve requests for static content such as javascript, stylesheets and images and instruct clients to cache it for 14 days which will reduce the load on Tomcat and improve overall performance. Include the following configuration in nginx.conf:</para>
+    <para>nginx configuration is built around a hierarchy of blocks representing http, server and location, where each block inherit settings from parent blocks. The following snippet will configure nginx to proxy pass (redirect) requests from port 80 (which is the port nginx will listen on by default) to our Tomcat instance. It will also make nginx serve requests for static content such as javascript, stylesheets and images and instruct clients to cache it for 4 days which will reduce the load on Tomcat and improve overall performance. Include the following configuration in nginx.conf:</para>
     <para><screen><![CDATA[server {
   listen       80;
 
   # Serve static content
   # Root points to your DHIS webapp location, update it!
 
-  location ~* (\.js$|\.css$|\.gif$|^/images/|^/icons/) {
+  location ~* (\.js$|\.css$|\.gif$|\.woff$|\.ttf$|\.eot$|^/images/|^/icons/|^/dhis-web-commons/.*\.png$) {
     root     /home/dhis/tomcat/webapps/ROOT;
-    expires  14d;
+    expires  4d;
   } 
 
   # Proxy pass to servlet container
@@ -145,9 +145,9 @@
 
   # Root points to your DHIS webapp location, update it!
 
-  location ~* (\.js$|\.css$|\.gif$|^/images/|^/icons/) {
+  location ~* location ~* (\.js$|\.css$|\.gif$|\.woff$|\.ttf$|\.eot$|^/images/|^/icons/|^/dhis-web-commons/.*\.png$) {
     root     /home/dhis/tomcat/webapps/ROOT;
-    expires  14d;
+    expires  4d;
   } 
 
   location / {
@@ -158,6 +158,7 @@
     proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
  }
 }]]></screen>
+    <para>The location block for static content is essential as web browser will not cache static content by default over SSL. It will only cache such content on the client side  if told explicitly by the web server.</para>
   </section>
   <section>
     <title>Reverse proxy with Apache (optional)</title>