ubuntu Apache 设置反向代理

2018年3月16日 4213点热度 3人点赞 0条评论

首先需要用到proxy_module和proxy_http_module这两个模块,而通过apt安装的Apache默认是没有开启这两个模块的,可以通过下面两个命令开启:

shella2enmod proxy
a2enmod proxy_http

然后重启Apache,通过

shellapache2ctl -M | grep proxy

命令查看两个模块是否启用成功

shellproxy_module (shared)
proxy_http_module (shared)

然后像平常添加网站一样建立conf文件就好了


<VirtualHost *:80>
    ServerName example.com
    ProxyPass / http://127.0.0.1:port/
    ProxyPassReverse / http://127.0.0.1:port/
</VirtualHost>

 

jlqwer

这个人很懒,什么都没留下

文章评论