Install Nginx reverse proxy with Apache

How to installing nginx on linux Debian/Ubuntu

    #aptitude install nginx

Configure nginx as reverse proxy

+ Create reverse proxy setup file

   #cd /etc/nginx/conf.d

#vi proxy.conf

#### reverse proxy setup for nginx

proxy_redirect                  off;

proxy_set_header            Host                    $host;

proxy_set_header            X-Real-IP          $remote_addr;

proxy_set_header            X-Forwarded-For        $proxy_add_x_forwarded_for;

client_max_body_size         10m;

client_body_buffer_size      128k;

proxy_connect_timeout      90;

proxy_send_timeout             90;

proxy_read_timeout              90;

proxy_buffers                             32     4k;

+Setup proxy_pass on vhost/nginx.conf


server {

listen         80;


access_log          /var/log/nginx/;

error_log           /var/log/nginx/;

location / {

proxy_pass ;

include                /etc/nginx/conf.d/proxy.conf;



Testing and restart nginx

      #nginx -t

#/etc/init.d/nginx restart

Installing apache and rpaf module

        #aptitude install apache2 libapache2-mod-rpaf

Configure apache to use nginx proxy

+ Change port

         #vi  /etc/apache2/ports.conf

NameVirtualHost   *:8080

Listen 8080

+Enable rpaf-module on apache

           #vi /etc/apache2/sites-enabled/000-default

<VirtualHost   *:8080>

### add these line in VirtualHost configuration

<IfModule mod_rpaf.c>

RPAFenable                On

RPAFsethostname   On

RPAFproxy_ips   ### Can use  multiple IP address



Starting apached

           #/etc/init.d/apache2 start

checking open port for nginx and apache

            #netstat -tlpn | grep 80

Testing: Open your host in browser


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s