Welcome! Log In Create A New Profile


Switch from Apache 1.3.x to NGinx

Posted by miky 
Switch from Apache 1.3.x to NGinx
January 12, 2013 02:34PM

I'm using Apache 1.3.x along with gzip, url rewriting, php, mod expires and ssl.
I've started to work on my NGinx configuration with gzip modules according to the documentation and I think I'll be ok with that.

I would like to know how to replaces mod expires. I have now a .htaccess in each directory containing the configuration
ExpiresActive on
ExpiresDefault A60
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000

Could you confirm that I have to use the module HttpHeadersMoreModule ?

Also, it seems that the configuration for this behavior is very centralised into the nginx.conf file. What do you suggest to have a different "expires" depending on the directory. With Apache it's easy, you place the .htaccess within the directory.

Thank you
Re: Switch from Apache 1.3.x to NGinx
May 07, 2013 08:19AM

Perhaps, late answer but I am trying to help anyway.

nginx does not support .htaccess files per directory, so you must configure expire on the server level, instead:

server {


location ~ \.gif$ {
expires 1M;

location ~ \.html?$ {
expires 1w;



loco (at) andrews.lv
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 104
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready