Centos 6 安装httpd反向代理

  1. 系统采用默认最小安装 CentOS release 6.3

  2. 安装apache服务器

yum -y install httpd

3.配置虚拟服务器

3.1 增加配置文件

vi /etc/httpd/conf.d/v.conf

3.2 配置文件内容

<virtualhost *:80>
    ServerAdmin nic@qzlab.cn
    ServerName www.qzlab.cn
    <location /map>
        Order allow,deny
        Allow from all
        ProxyPass  http://10.10.1.150/map  retry=3
        ProxyPassReverse http://10.10.1.150/map
    </location>
    <location /cms>
        Order allow,deny
        Allow from all
        ProxyPass  http://10.10.1.186/cms/  retry=3
        ProxyPassReverse http://10.10.1.186/cms/
    </location>

    <location / >
        Order allow,deny
        Allow from all
        ProxyPass  http://10.10.1.186/  retry=3
        ProxyPassReverse http://10.10.1.186/
    </location>
    ErrorLog logs/qztc-error_log
    CustomLog logs/qztc-access_log common
</virtualhost>

4.重启服务器

/etc/init.d/httpd restart