:: how to installing nginx on linux debian

# 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

# vi blackonsole.com.conf
server {
   listen  80;
   server_name  blackonsole.com www.blackonsole.com;

   access_log  /var/log/nginx/blackonsole.com.access.log ;
   error_log	/var/log/nginx/blackonsole.com.error.log ;

   location / {
	proxy_pass	//10.100.100.80:8080/ ;
	include		/etc/nginx/conf.d/proxy.conf;
   }
}

:: testing and restarting 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

### add these line in VirtualHost configuration
   RPAFenable      On
   RPAFsethostname On
   RPAFproxy_ips   127.0.0.1 10.100.100.80 ### can use multiple IP address

:: starting apached

# /etc/init.d/apache2 start

:: checking open port for nginx and apache

# netstat -tlpn | grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      16548/nginx
tcp6       0      0 :::8080                 :::*                    LISTEN      17347/apache2
tcp6       0      0 :::80                   :::*                    LISTEN      16548/nginx

:: testing
open your host / domainame using web browser.

//blackonsole.com

:: links
+ google
+ ubuntu

Hi, Iā€™m Sysadmin.ID

5 Comments

  1. mas…
    iku mari install rpaf, kiro2 nek httpd.conf butuh load module po ra?

    LoadModule rpaf_module /usr/lib64/httpd/modules/mod_rpaf-2.0.so

Leave a Reply

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