apache 配置参考:
设置反向代理 三个文件
\conf\httpd.conf
\conf\extra\httpd-proxy.conf
\conf\extra\httpd-vhosts.conf
1.设置httpd.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
(Ps:很多人都会注释LoadModuleproxy_balancer_modulemodules/mod_proxy_balancer.so,然而这个是做负载均衡用的一个功能,单纯做反向代理的话,不需要用这个,而且取消了这里的注释不进行相应的设置的话,会导致apache服务无法开启)
然后找到
Include conf/extra/httpd-vhosts.conf
这一行前面的注释‘#’也删除,引入这个文件
配置参考:
<VirtualHost *:80>
ServerAdmin admin@qq.com
php_admin_value open_basedir "/home/wwwroot/pdry.cn:/tmp/:/var/tmp/:/proc/"
DocumentRoot "/home/wwwroot/pdry.cn"
ServerName pdry.cn
ServerAlias www.pdry.cn
ServerAlias www.pdry.cn
#ErrorLog "/home/wwwlogs/pdry.cn-error_log"
#CustomLog "/home/wwwlogs/pdry.cn-access_log" combined
ProxyPass /hot http://45.80.115.234:6060/hot/
ProxyPassReverse /hot http://45.80.115.234:6060/hot/
ProxyPassMatch "^(/hot.*)$" "http://45.80.115.234:6060/$1"
<Directory "/home/wwwroot/pdry.cn">
SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.html index.php
</Directory>
</VirtualHost>
nginx 反向代理二级泛目录配置
小旋风
location /xxxx {
proxy_pass http://ip:1000/biaoshi@;
proxy_set_header X-FORWARDED-HOST $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
D58 配置
#=========反代========
location /bz {
proxy_pass http://103.200.124.221:6065/bz/;
}
location ~ /bz/.*\.(gif|jpg|jpeg|png|bmp|swf|ttf|woff2|woff|js|css)$ {
proxy_pass http://103.200.124.221:6065;
}
iis配置参考:
<rule name="fxdl" stopProcessing="true">
<match url="^hot(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="(.*)" ignoreCase="false" />
</conditions>
<action type="Rewrite" url=http://10.21.213.11:6063/hot/{R:1} />
</rule>
iis配置需要下载安装一个 反代组件,下载地址::https://wws.lanzoui.com/idICvvzwaud
转载请注明:创富者 » apache nginx iis 配置反向代理二级泛目录