...Incoming burst...


Let’s setup a reverse proxy on Debian with nginx, using nginx server.

We will work on a single machine, using the loopback interface (i.e. 127.0.0.1). Pre-requisites:

In our example, we will use example.com, and the hosts file entry will look like this:

127.0.0.1 example.com


Let’s install it:

sudo apt install nginx


By default, you will find nginx’s configuration at /etc/nginx/.

Deactivate the default configuration, by first removing the symlink to the default configuration then restart the server:

unlink /etc/nginx/sites-enabled/default
service nginx restart


You can signal the server to reload it’s configuration by sending a SIGHUP:

nginx -s reload


Create a reverse proxy configuration file at /etc/nginx/sites-available/myproxy.conf:

server {
  listen 80;
  server_name www.example.com

  location / {
    proxy_pass http://127.0.0.1:8080;
  }

}


Create a symlink to the sites-enabled folder:

link /etc/nginx/sites-available/myproxy.conf /etc/nginx/sites-enabled/myproxy.conf

The previous configuration produces the following:

Let’s verify the configuration’s integrity:

nginx -t


In case of error, read it and fix it.

Now reload the server:

nginx -s reload


Test it.



...Sent by Lazy Monkey...