IIS7:
首先前往http://www.iis.net/extensions/ApplicationRequestRouting下载Application Request Routing,然后安装
安装完后在IIS管理界面找到ARR配置菜单:Application Request Routing
点击右侧开启Proxy项:server proxy settings..
打开配置界面 在Enable proxy前面打勾保存
在站点下建立web.config或者修改现有文件:
以abc目录为例
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <rewrite>
- <rules>
- <rule name="fxdl" stopProcessing="true">
- <match url="^abc(.*)" />
- <conditions>
- <add input="{HTTP_HOST}" pattern="(.*)" ignoreCase="false" />
- </conditions>
- <action type="Rewrite" url="http://www.yuanzihezhanqun.com/abc{R:1}" />
- </rule>
- </rules>
- </rewrite>
- </system.webServer>
- </configuration>
复制代码
Apache:
打开Apache安装目录下 /conf/httpd.conf 设置文件,找到以下几行把前面的注释‘#’删除 - LoadModule proxy_module modules/mod_proxy.so
- LoadModule proxy_connect_modulemodules/mod_proxy_connect.so
- LoadModule proxy_ftp_modulemodules/mod_proxy_ftp.so
- LoadModuleproxy_http_modulemodules/mod_proxy_http.so
- Include conf/extra/httpd-vhosts.conf
复制代码然后修改站点配置文件: 以abc目录为例 - <VirtualHost *:80>
- ServerAdmin webmaster@127.0.0.1 #主机名
- #DocumentRoot "d:/**/htdocs/xx.com"
- ServerName 127.0.0.1
- ServerAlias 127.0.0.1
- #ErrorLog "logs/xx.com-error.log"
- #CustomLog "logs/xx.com-access.log" common
- ProxyPass /abc http://www.yuanzihezhanqun.com/abc
- </VirtualHost>
复制代码Nginx: 打开站点配置文件,加入以下代码: - location /abc/ {
- proxy_pass http://www.yuanzihezhanqun.com;
- }
复制代码
|