Let's share the following. This method is applicable to the LNMP one-key package of June and the AMH host panel (of course, AMH comes with the anti-generation module.
The following is a simple reverse proxy configuration:
Server
{
Listen 80;
Server_name 111cn.net www.111cn.net;
Location /{
Proxy_pass http://www.baidu.com;
Proxy_redirect off;
Proxy_set_header X-Real-IP $ remote_addr;
Proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
}
}
Field explanation:
Server_name: your own domain name
Proxy_pass: the domain name to be reversed. The Baidu address entered here is used to request Baidu content and return it to the client when accessing www.111cn.net.
Save the above code as "your domain name. conf ", such as 111cn.net. conf, then place the configuration file to "/usr/local/nginx/conf/vhost" on the server, and then restart the nginx service. LNMP 1.2 enter the command "lnmp nginx restart ", AMH 4.2 enter the command "amh nginx restart" to restart and take effect.
Finally, resolve your domain name to the server where it is located for access. The above rules only implement the most basic reverse proxy. In addition, you can use nginx rules to implement keyword replacement and cache directories, if you are interested, you can find more information about nginx on the Internet.