suse linux apache 安装 反向代理设置

安装apache

zypper in apache2

apache配置文件目录 /etc/apache2

配置加载反向代理所需的模块,在/etc/apache2/conf.d/增加一个.conf配置文件,输入模块加载命令

vi /etc/apache2/conf.d/fandai.conf

输入
LoadModule proxy_module              /usr/lib64/apache2-prefork/mod_proxy.so
LoadModule proxy_connect_module              /usr/lib64/apache2-prefork/mod_proxy_connect.so
LoadModule proxy_ftp_module              /usr/lib64/apache2-prefork/mod_proxy_ftp.so
LoadModule proxy_http_module              /usr/lib64/apache2-prefork/mod_proxy_http.so
保存退出

检查/etc/apache2/listen.conf  确认要apache监听的端口,默认80和443.

复制/etc/apache2/vhosts.d/vhost.template 模版,新增一个反代使用的vhost配置之文件
cp /etc/apache2/vhosts.d/vhost.template /etc/apache2/vhosts.d/fandai.conf

编辑fandai.conf 在VirtualHost段中增加反向代理配置
vi /etc/apache2/vhosts.d/fandai.conf
增加

</Directory>

#增加的反向代理设置

ProxyPass /childpalace http://10.0.20.22:11000/childpalace
ProxyPassReverse /childpalace http://10.0.20.22:11000/childpalace

ProxyPass /childpalacebc http://10.0.20.22:11000/childpalacebc
ProxyPassReverse /childpalacebc http://10.0.20.22:11000/childpalacebc

ProxyPass /market http://10.0.20.22:11000/market
ProxyPassReverse /market http://10.0.20.22:11000/market

ProxyPass /tjopen http://10.0.20.22:11000/tjopen
ProxyPassReverse /tjopen http://10.0.20.22:11000/tjopen

ProxyPass /traffic http://10.0.20.22:11000/traffic
ProxyPassReverse /traffic http://10.0.20.22:11000/traffic

ProxyPass /unionpay_displaybc http://10.0.20.22:11000/unionpay_displaybc
ProxyPassReverse /unionpay_displaybc http://10.0.20.22:11000/unionpay_displaybc

ProxyPass /unionpay_display http://10.0.20.22:11000/unionpay_display
ProxyPassReverse /unionpay_display http://10.0.20.22:11000/unionpay_display

ProxyPass /unionpay_weixin http://10.0.20.22:11000/unionpay_weixin
ProxyPassReverse /unionpay_weixin http://10.0.20.22:11000/unionpay_weixin

#增加的反向代理配置结束
</VirtualHost>

保存退出

设置自动启动

suse 11的设置
chkconfig -a apache2

suse 13的设置

# 查看当前系统的所有 Target
$ systemctl list-unit-files --type=target

# 查看一个 Target 包含的所有 Unit
$ systemctl list-dependencies multi-user.target

# 查看启动时的默认 Target
$ systemctl get-defaul

启动apache

suse 11
启动 service  apache2 start
停止 service  apache2 stop
查看状态 service  apache2 status

suse 12
启动  systemctl start apache2
停止  systemctl stop apache2
查看  systemctl status apache2
重新加载 systemctl reload apache2

参考文档
suse 11的apache 设置
https://www.suse.com/zh-cn/documentation/sles11/singlehtml/book_sle_admin/cha.apache2.html#sec.apache2.modules
systemd 配置
http://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-commands.html

反向代理的设置

http://www.cnblogs.com/zemliu/archive/2012/04/18/2454655.html

© 2017, 新之助meow. 原创文章转载请注明: 转载自http://www.xinmeow.com

0.00 avg. rating (0% score) - 0 votes
点赞