[opencms-dev] opencms with nginx - static export

originalstoic originalstoic at yahoo.com
Tue Sep 10 23:43:38 CEST 2013


I see noone ever replied to this message thus leaving it a mystery for those
who haven't yet figured this out.  So I will post the solution to what I
think the problem is that the author asked.

In opencms there is a 404 uri/servlet that gets redirected too when content
that needs to be exported to the rfs(real file system) that are in the
vfs(virtual file system) isn't yet there(stuff like js, images, etc... that
you store in opencms but you want your webserver(apache, nginx) rather than
your app server(tomcat, weblogic) to handle.  You hit it the first time and
then the servlets pushes those out to the rfs to the expected spot.

in NGINX you do it this way:
location /export {
        try_files $uri /handle404?exporturi=$uri&$args;
        expires       24h;
        add_header    Cache-Control  private;
    }

in Apache you do it this way:
	# Make sure on-demand export of OpenCms files works
	RewriteCond       %{REQUEST_URI}                                           
^/export/(.*) [NC]
	RewriteCond       "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}"                    
!-f
	RewriteCond       "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index_export.html"  
!-f
	RewriteRule       .*
http://localhost:8081/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]

ironically I had to figure NGINX out for myself but I got most of it up and
running from this post.




--
View this message in context: http://opencms.996256.n3.nabble.com/opencms-with-nginx-static-export-tp22844p23590.html
Sent from the OpenCMS mailing list archive at Nabble.com.



More information about the opencms-dev mailing list