[CentOS 7LNMP architecture 30], set nginx agent#

Keywords: Operation & Maintenance Nginx curl Web Server

shallow A kind of ove

nginx agent

The user sends information to the proxy server, the web server receives the information from the proxy server, returns it to the proxy server, and finally sends it to the user The online environment needs to resolve the domain name of the website to the proxy server, so that the user's request goes to the proxy, and then the proxy helps the user to get the data from the real server, and then the proxy feeds the data back to the user Similar to visiting foreign servers Similar to load balancing

  • cd /usr/local/nginx/conf/vhost

  • vi proxy.conf server { listen 80; server name ask.apelearn.com;

      location \/
      {
      	proxy_pass http://121.201.9.155/;
      	proxy_set_header Host $host;
      	proxy_set_header X-Real-IP $remote_addr;
      	proxy_set_header X-Forwarded-For        $proxy_add_x_forwarded_for;
      }
    

    }

[root@localhost ~]# cd /usr/local/nginx/conf/vhost/
[root@localhost vhost]# vi proxy.conf
      1 server
      2 {
      3         listen 80;
      4         server_name ask.apelearn.com;
      5 
      6         location /
      7         {
      8                 proxy_pass http://121.201.9.155/;
      9                 proxy_set_header Host   $host;
     10                 proxy_set_header X-Real-IP      $remote_addr;
     11                 proxy_set_header X-Forwarded-For        $proxy_add_x_forwarded_for;
     12         }
     13 }
[root@localhost vhost]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost vhost]# /usr/local/nginx/sbin/nginx -s reload
[root@localhost vhost]# curl ask.apelearn.com/roobots.txt

[root@localhost vhost]# curl ask.apelearn.com/roobots.txt
#
# robots.txt for MiWen
#

User-agent: *

Disallow: /?/admin/
Disallow: /?/people/
Disallow: /?/question/
Disallow: /account/
Disallow: /app/
Disallow: /cache/
Disallow: /install/
Disallow: /models/
Disallow: /crond/run/
Disallow: /search/
Disallow: /static/
Disallow: /setting/
Disallow: /system/
Disallow: /tmp/
Disallow: /themes/
Disallow: /uploads/
Disallow: /url-*
Disallow: /views/
Disallow: /*/ajax/
[root@localhost vhost]# curl -x 127.0.0.1:80  ask.apelearn.com/roobots.txt
#
# robots.txt for MiWen
#

User-agent: *

Disallow: /?/admin/
Disallow: /?/people/
Disallow: /?/question/
Disallow: /account/
Disallow: /app/
Disallow: /cache/
Disallow: /install/
Disallow: /models/
Disallow: /crond/run/
Disallow: /search/
Disallow: /static/
Disallow: /setting/
Disallow: /system/
Disallow: /tmp/
Disallow: /themes/
Disallow: /uploads/
Disallow: /url-*
Disallow: /views/
Disallow: /*/ajax/

Posted by wilzy1 on Fri, 01 Nov 2019 01:25:04 -0700