Nethence NEWDOC OLDDOC Lab Webmail Your IP BBDock  

Setting up a reverse-proxy with NGINX


On Ubuntu,

    apt install nginx
    #rm -f /var/www/html/index.nginx-debian.html

On RHEL/CentOS, make sure the EPEL repo is available and proceed,

    yum install nginx
    netstat -antpe --inet --inet6 | grep LISTEN | grep 80
    service nginx start
    chkconfig nginx on


Setup the server root and get rid of the welcome page,

cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.dist
vi /etc/nginx/nginx.conf
(change /usr/share/nginx/html)

Enable directory listing,

    server {
        location / {
                index  index.php index.html index.htm;
                autoindex on;

and apply with service nginx restart

Reverse Proxy

Setup a http reverse proxy,

cd /etc/nginx/conf.d/
vi vhost.conf

server {
 listen 80;

 location / {
   proxy_set_header X-Real-IP $remote_addr;


service nginx restart
#centos: chkconfig nginx on
#ubuntu: update-rc.d nginx defaults