Nginx on Apache using Nginx Admin

Nginx on Apache

Installation

cd /usr/local/src
wget http://nginxcp.com/nginxadmin2.3-stable.tar
tar xf nginxadmin2.3-stable.tar
cd publicnginx
./nginxinstaller install

After you installed it go to WHM Tweak Settings > System > and change in the field Apache non-SSL IP/port [?] the value 80 to 8081 save the settings. now you need to enable in your firewall the port 8081.

Edit crontab via ssh with command:
crontab -e

Add this line to it:
*/15 * * * * /usr/sbin/tmpwatch -am 4 /tmp/nginx_client

Disallow an account to use Nginx

mkdir /etc/nginx/staticvhosts
cp /etc/nginx/vhosts/yourdomain.com /etc/nginx/staticvhosts/yourdomain.com
rm /etc/nginx/vhosts/yourdomain.com
open up /etc/nginx/staticvhosts/yourdomain.com
and in the location line remove |html|Htm and all ententions you wanna served via apache.
then in /etc/nginx/nginx.conf at the bottom, add include "/etc/nginx/staticvhosts/*";
restart nginx
/etc/init.d/httpd restart

Rebuild Vhosts

rm -rf /etc/nginx/vhosts
/scripts/createvhosts.py
/etc/init.d/httpd restart

Configurations

worker_processes : Set the number of nginx workers to the number of CPUs your server has.
worker_connections: This is the amount of client connections a single child process will handle by themselves at any one time. (default: 1024) Note: Multiply worker_processes times worker_connections for the total amount of connections Nginx will handle. Clients who connect after the max has been reached will be denied access.
keepalive_timeout 60 60; the first value is for keep-alive connections with the client. The second parameter assigns the value “Keep-Alive: timeout=time” in the header of answer. This header can convince some browsers to close the connection, so that the server does not have to.

Exclude File Type

Edit etc/nginx/vhosts/Yourdomainhere.com
and in the location line remove |html|htm and any file type which you want to serve via apache

restart nginx
/etc/init.d/httpd restart

Nginx Failing?

Enable piped Apache logs via Main >> Service Configuration >> Apache Configuration >> Piped Log Configuration

Use Apache for one site

edit /etc/nginx/vhosts/domain.com and remove file extensions which you want to served by apache.

Leave a comment

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