OP 13 March, 2021 - 09:54 AM
There are numerous situations, where a reverse proxy for your web server can be useful
It is pretty easy to setup, however, depending on your operation, you might need some additional configuration
We will set up an Nginx on our server with IP 5.206.xxx.xxx, which will act as a reverse proxy and pass our requests to [url=javascript:void(0)]1.1.1.1[/url] (Cloudflare App)
Installing Nginx
After a successful installation of nginx, head over to the configuration file
Search for location and remove the following line:try_files $uri $uri/ =404;
Then replace it with...
Instead of [url=javascript:void(0)]1.1.1.1[/url] you could use another site as well, maybe your own site, in order to hide it's IP?
Or a site you always want to access with the servers IP? (NOTE: You will have to take care of the forwarded by header then, which would reveal your real IP)
Now let's test the configuration
Restart and reload nginx and we are ready to go!
Now on to the test, our server IP should now show the contents of [url=javascript:void(0)]1.1.1.1[/url], when accessed and...
It works! Our Nginx server now forwards all requests to [url=javascript:void(0)]1.1.1.1[/url]
It is pretty easy to setup, however, depending on your operation, you might need some additional configuration
We will set up an Nginx on our server with IP 5.206.xxx.xxx, which will act as a reverse proxy and pass our requests to [url=javascript:void(0)]1.1.1.1[/url] (Cloudflare App)
Installing Nginx
Code:
apt -y install nginx
After a successful installation of nginx, head over to the configuration file
Code:
nano /etc/nginx/sites-enabled/default
Search for location and remove the following line:try_files $uri $uri/ =404;
Then replace it with...
Code:
proxy_pass https://1.1.1.1
Instead of [url=javascript:void(0)]1.1.1.1[/url] you could use another site as well, maybe your own site, in order to hide it's IP?
Or a site you always want to access with the servers IP? (NOTE: You will have to take care of the forwarded by header then, which would reveal your real IP)
Now let's test the configuration
Code:
root@guardian:/etc/nginx/sites-available# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Restart and reload nginx and we are ready to go!
Code:
systemctl restart nginx
systemctl reload nginx
Now on to the test, our server IP should now show the contents of [url=javascript:void(0)]1.1.1.1[/url], when accessed and...
It works! Our Nginx server now forwards all requests to [url=javascript:void(0)]1.1.1.1[/url]