NGINX + Apache on Directadmin

Материал из Webko Wiki
Перейти к навигации Перейти к поиску

Custombuild 2 allows us to have a reverse-proxy NGINX + Apache on Directadmin powered server without a need for any 3rd party scripts or plugins, addons. That's quite easy to start using it.

CustomBuild 2.x version

First of all make sure you've got custombuild 2: Code:

cd /usr/local/directadmin/custombuild
./build version

You should see an output similar to the following:

[root@server custombuild]# ./build version
2.0.0-RC7 (rev: 863)


If it differes much then you've got custombuild 1.x

Directadmin version

To check directadmin version run this code:

[root@server custombuild]# /usr/local/directadmin/directadmin v
Version: DirectAdmin v.1.45.4

Make sure to have version of directadmin no less than 1.45.2 otherwise the things won't work.

Custombuild 2.x: NGINX + Apache

Run this code to build nginx + apache with custombuild:

cd /usr/local/directamin/custombuild
./build update
./build update_da
./build set webserver nginx_apache
./build nginx_apache
./build rewrite_confs

That's it. Have fun with it.

UPDATE #1: Real IP on Apache`s server-status page (*** ACTUAL VERSION OF APACHE SHOULD HAVE IT FIXED ALREADY ***)

Please do not follow this update #1 if you have the latest apache version with a patch that fixes the issue!

Apache gets real IPs, you may see it in $_SERVER with PHP or in apache logs; but it shows incorrect IP in apache's server status.

Before to start, please make sure to have unzip installed on your server:

On RHEL/CentOS

yum install unzip

On Debian/Ubuntu

apt-get install unzip

To get real IPs instead 127.0.0.1 on Apache`s server-status page you need to install mod_rpaf, as remoteip is buggy in this case:


cd /usr/local/src
wget https://github.com/y-ken/mod_rpaf/archive/master.zip
unzip master.zip
cd mod_rpaf-master
/bin/sed -i "s/remote_/client_/g" mod_rpaf-2.0.c
make && make install

and insert following instructions:

LoadModule rpaf_module      /usr/lib/apache/mod_rpaf-2.0.so
<IfModule mod_rpaf-2.0.c>
    RPAFenable On
    RPAFproxy_ips 127.0.0.1
    RPAFsethostname On
    RPAFheader X-Client-IP
</IfModule>

into /etc/httpd/conf/extra/httpd-includes.conf and restart apache.