1024programmer Nginx Configure nginx reverse proxy on linuxvps

Configure nginx reverse proxy on linuxvps

What is a reverse proxy?
A reverse proxy refers to a proxy server that accepts a connection request on the Internet, then forwards the request to a server on an internal (or other) network, and returns the result obtained from the server to the client requesting a connection on the Internet.

How to do it:
For example, I want to build a www.server110.com is used as a reverse proxy to access twitter. First, the domain name management at the domain name registrar is the domain name www .server110.com add A record to the IP of the VPS , and then modify the Nginx configuration file on the VPS, adding the following:
server
{
listen 80;
server_name www.server110.com;
Location / {
http://twitter.com/;
Proxy_redirect off;
$remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
After adding, execute first:
/usr/local/nginx/sbin/nginx -t
Check whether the configuration is normal, if it shows:
the
configuration file /usr/local/nginx/conf/nginx.conf syntax is
ok
configuration file
/usr/local/nginx/conf/nginx.conf test is successful
It is normal, otherwise modify the configuration according to the error prompt.
Then execute kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
Make the configuration take effect, after the domain name resolution takes effect, you can pass www.server110.com visited twitter.

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/configure-nginx-reverse-proxy-on-linuxvps/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索