mod_expires problem with install

Mattpl

Verified User
Joined
Jun 28, 2017
Messages
84
Location
ZS
Hi I need to instal mod_expires (custombuild). How I do this"

cd /usr/local/directadmin/custombuild
nano custom/ap2/configure.apache
in configure.apache add "--enable-expires"

Then ./build clean
./build apache and I have error

Server Version: 2.4.27
Install prefix: /etc/httpd
C compiler: gcc -std=gnu99
CFLAGS: -I/usr/local/include -pthread
LDFLAGS: -L/usr/local/lib
LIBS: -lsystemd
CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE
C preprocessor: gcc -E

/usr/local/directadmin/custombuild/custom/ap2/configure.apache: line 41: --enable-expires: command not found

*** There was an error while trying to configure Apache 2. Check the custom/ap2/configure.apache file
root@serwer:/usr/local/directadmin/custombuild# ./build clean
 
Hello,

First of all Apache on Directadmin server built with CustomBuild already has mod_expires enabled, check and see:

/usr/local/directadmin/custombuild/configure/ap2/configure.apache:

Code:
        "--enable-proxy" \
[B]        "--enable-expires" \[/B]
        "--enable-reqtimeout" \

and:

Code:
# apachectl -M 2>&1 | grep expires
[B] expires_module (static)[/B]

Secondly your config file is missing "" a previous line.
 
I was testing all posibilites with "" and del sign / and still error
In my case mod_expires not working, beacause I want use browser cache and add into htaccess special code and this not work.
My file (last lines):
#!/bin/sh
"./configure" \
"--libexecdir=/usr/lib/apache" \
"--libdir=/usr/lib/apache" \
"--mandir=/usr/share/man" \
"--datadir=/var/www" \
"--localstatedir=/var" \
"--enable-logio" \
"--enable-ssl" \
"--enable-rewrite" \
"--enable-proxy" \
"--enable-expires" \
"--enable-reqtimeout" \
"--with-ssl=/usr" \
"--enable-headers"

My .htaccess
RewriteEngine on
RewriteBase /

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
 
Last edited:
Are you sure that your apache is built without expires module?

Are you using NGINX in front-of Apache? You need to tune NGINX not Apache if you have nginx+apache setup.

I was testing all posibilites with "" and del sign / and still error

The char \ (back-slash) should be used, it is not the same as / (forward-slash). And no white-space should precede a back-slash, only a line-break.


> Secondly your config file is missing "" a previous line.
I guess the forums ate my \ (back-slash) in my previous reply.
 
Yeap I have add code into .htaccess and in pagespeed insights I have error with browser caching (same code I have add to another server and there's working)

I'm using only apache. Custombuild -> Edit Options -> WEB Server Settings: Apache ver2.4

apachectl -M
expires_module (static)
 
Last edited:
Again, by the default mod expires is installed and enabled in Apache.

Make sure that the URLs which are not cached are hosted on the same server and are not loaded from remote servers that you don't control.
 
Back
Top