Difference between revisions of "Nginx as Reverse Proxy"

From PKC
Jump to navigation Jump to search
Ben>Admin
Ben>Admin
Line 16: Line 16:
cd /etc/nginx/sites-available
cd /etc/nginx/sites-available
</syntaxhighlight>
</syntaxhighlight>
Use a text editor or copy a file with the following file name: <code>reverse-proxy.conf</code>.
For example:
<syntaxhighlight>
vi reverse-proxy.conf
</syntaxhighlight>
Use a text editor or copy a file with the following file name: <code>reverse-proxy.conf</code>.
For example, use the text editor vi, you can type the following command:
<syntaxhighlight>
vi reverse-proxy.conf
</syntaxhighlight>
In the file, type in the following content:
<syntaxhighlight>
server {
    listen 80;
    location / {
        proxy_pass http://127.0.0.1:9352;
    }
}
</syntaxhighlight>





Revision as of 16:57, 24 April 2021

The first place to learn Nginx can be found in this book[1]:

The following code can be copied and pasted to perform the task of installing Nginx on Ubuntu:[2]

sudo apt-get update
sudo apt-get install nginx -y

Then, try to unlink this existing link:

sudo unlink /etc/nginx/sites-enabled/default

Now go to the Nginx site-available directory

cd /etc/nginx/sites-available

Use a text editor or copy a file with the following file name: reverse-proxy.conf.

For example:

vi reverse-proxy.conf

Use a text editor or copy a file with the following file name: reverse-proxy.conf.

For example, use the text editor vi, you can type the following command:

vi reverse-proxy.conf


In the file, type in the following content:

server {
    listen 80;
    location / {
        proxy_pass http://127.0.0.1:9352;
    }
}




References

  1. eJonghe, D. (2017). NGINX cookbook : advanced recipes for operations(First edition. ed., pp. 1 online resource (1 volume)). Retrieved from https://go.oreilly.com/massachusetts-institute-of-technology-mit/library/view/-/9781492049098/?ar
  2. Edward S., How to Set Up an Nginx Reverse Proxy, Retrieved from https://www.hostinger.com/tutorials/how-to-set-up-nginx-reverse-proxy/