Updating, recompiling, VirtualHost templates, customizations, php safemode … I need to ensure I have mod_rewrite enabled.

Updating, recompiling, VirtualHost templates, customizations, php safemode … I need to ensure I have mod_rewrite enabled.

We are getting this question quite a bit, but is not too sure why.  It’s always enabling in Apache by default.
To confirm, type:

/usr/sbin/httpd -l | grep mod_rewrite

and you should see

 mod_rewrite.c

in the output if it’s enabled.

If not, then it is possibly you’re not using one of our compiled binaries, in which case, recompile apache and php:

/usr/local/directadmin/custombuild
./build all d
./build rewrite_confs

and confirm the “Server built” date is current:

/usr/sbin/httpd -V

Which Apache mpm am I using?

Though You can ask the httpd binary which mpm is in use with your setup.
Type:

httpd -V | grep ‘Server MPM:’

Most systems will run “prefork” with mod_php, and “event” for php-fpm

Add mod_cloudflare to DirectAdmin

Relating to this guide, you can install the mod_cloudflare module into apache if you need it.

On a DirectAdmin box, we will use the httpd-includes.conf file, as it is not modifying by CustomBuild once it’s set.

  1. Once apache is up and running, download and install the mod_cloudflare module:

    wget https://www.cloudflare.com/static/misc/mod_cloudflare/mod_cloudflare.c
    apxs -i -c mod_cloudflare.c

  2. Next, add the module to the httpd-includes.conf:

    echo “LoadModule cloudflare_module  /usr/lib/apache/mod_cloudflare.so” >> /etc/httpd/conf/extra/httpd-includes.conf

  3. and finally restart apache:

    service httpd restart

 

CageFS with awstats: Can’t open perl script “/usr/local/awstats/tools/awstats_buildstaticpages.pl”: No such file or directory

If your awstats that are not working with CageFS and you are getting an error like this when testing it manually:

[root@server scripts]# ./awstats_process.sh user domain.com
Conversion not required. Continuing normally
Can’t open perl script “/usr/local/awstats/tools/awstats_buildstaticpages.pl”: No such file or directory
Cleanup…

it likely means the data has not been copying over to the skeleton folder in

/usr/share/cagefs-skeleton/usr/local/

To get around that, edit:

/etc/cagefs/conf.d/directadmin.cfg

and add 2 values, so beginning of the line looks like this, assuming :

paths=/usr/local/awstats/, /usr/local/awstats-7.7/, /usr/local/awstats, /usr/local/php….

where the bold bits are new.

Then run:

/usr/sbin/cagefsctl –force-update

which should copy the everything over to the cagefs-skeleton/usr/local path.  Just confirm it:

[root@server scripts]# ll /usr/share/cagefs-skeleton/usr/local
total 40
lrwxrwxrwx 1 root   root     11 Jun 26 22:57 awstats -> awstats-7.7
drwxr-xr-x 5 root   root   4096 Mar  1  2016 awstats-7.7

We add

  1. the literal awstats-7.7 directory
  2. the literal path to the awtstats link (without trailing slash)

If not sure if there was a change in CageFS, and older version of CafeFS, they have fixed a bug to prevent us from doing it the old way 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *