Can help me for How To Redirect IP Reverse Proxy Nginx To New IP Nginx ? Thanks For your answer :)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
In order to do a redirect to another IP address, all you need to do is add a simple snippet of code in your Nginx config file:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name domain.com www.domain.com;
return 301 IPAddress;
}
Alternatively, if you want to redirect as reverse proxy (to another port), what you can do is
server {
listen 80 default_server;
server_name domain.com;
location / {
proxy_pass http://123.123.123.1:41002/$uri;
proxy_set_header Host $host;
}
}
So, first you’ll need to change domain.com with your actual domain, 123.123.123.1 with the IP address you want to redirect it to as well as the port 41002 to your needs.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.