Nethence NEWDOC OLDDOC Lab Webmail Your IP BBDock  

Setting up a reverse-proxy with NGINX

Install

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

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;
 server_name host.example.com;

 location / {
   proxy_pass https://0.0.0.0:80XX;
   proxy_set_header X-Real-IP $remote_addr;
 }

}

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

References

https://gitlab.com/gitlab-org/omnibus-gitlab/issues/244