Reverse proxy

I want to run nginx as reverse proxy for apache2 on my server but virtualmin always make my configurations to fail !

Steps :

1- Install nginx using it's official repo :

2- Use this config file for nginx :

server {
    listen 80;
    server_name _;
    root /var/www;
    client_max_body_size 20M;
    location / {
        access_log      off;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_read_timeout 120;
        proxy_connect_timeout 120;

3- Install rpaf_module for apache :

4- Add the following config file for rpaf config : /etc/httpd/conf.d/rpaf.conf

LoadModule rpaf_module        /usr/lib/httpd/modules/
RPAFenable On
RPAFsethostname On
RPAFheader X-Forwarded-For

5- Alter the following lines in apache config file : /etc/httpd/conf/httpd.conf :


6- Change virtualmin configuration to use and port 81 as default virtualserver config. /etc/webmin/virtual-server/config


The problem is just with step 6, virtualmin could understand that use just for virtualserver IP, not for bind zone file !!

It also returns some error about non-matching IP addresses in Validate virtual-server section.

Please add this nice feature to virtualmin.



For step 6, you should instead change the IP to at Server Configuration -> Change IP Address.

Are you sure you really want to run Nginx as a proxy in front of Apache though? Unless your site is very heavily loaded, this isn't going to speed it up .. especially if you are serving any kind of dynamic (PHP-generated) content.

Mostafa's picture
Submitted by Mostafa on Fri, 08/03/2012 - 14:04

I've just had a test on one of my dedicated servers running high loaded websites on apache 2.4.2, php-fpm 5.3.15 and nginx 1.2.2 as reverse proxy. without nginx as reverse proxy : load average ~ 3.0 with nginx as revererse proxy in front of apache : load average ~ 0.6

Please add official support for reverse proxy. It's awesome.