• Linux Nginx反向代理小实例


    到此为止,我也不能说清楚什么事反向代理,我只知道nginx在签名做了一层代理,把请求都收到,然后分发给配置的真实的服务。并且把返回response给客户端;

    准备工作;安装好nginx;安装好apache;

    配置nginx代理;

    upstream site {
                server 120.25.153.74:8081;
                server 120.25.153.74:8082;
    }
    
    server {
      listen 80;
      server_name proxy.deetaa.com;
     
      #charset koi8-r;
     
      #access_log logs/host.access.log main;
     
      location / {
        root html;
        index index.html index.htm;
        proxy_pass http://site;
      }
    }

    Apache 配置:

    <VirtualHost *:8081>
        ServerAdmin cb@gosstech.net
        DocumentRoot "/home/apache/a1"
        ServerName localhost
    #   ServerAlias www.dummy-host.example.com:8081
        ErrorLog "logs/a1_error_log"
        CustomLog "logs/a1_access_log" common
        <Directory "/home/apache/a1/">
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:8082>
        ServerAdmin cb@gosstech.net
        DocumentRoot "/home/apache/a2"
        ServerName localhost
        ErrorLog "logs/a2_error_log"
        CustomLog "logs/a2_access_log" common
        <Directory "/home/apache/a2/">
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
        </Directory>
    </VirtualHost>

    请修改配置文件httpd listen 8081 8082

    重启Apache nginx

    访问proxy.deetaa.com

    upstream site {            server 120.25.153.74:8081;            server 120.25.153.74:8082;}
    server {listen 80;server_name proxy.deetaa.com; #charset koi8-r; #access_log logs/host.access.log main; location / {root html;index index.html index.htm;proxy_pass http://site; }}

  • 相关阅读:
    Beta冲刺置顶随笔
    Beta总结
    用户试用与调查报告
    Beta冲刺第七天
    Beta冲刺第六天
    Beta冲刺第五天
    Beta冲刺第四天
    Beta冲刺第三天
    Beta冲刺第二天
    爬虫基本操作
  • 原文地址:https://www.cnblogs.com/bin-pureLife/p/5091816.html
Copyright © 2020-2023  润新知