Apache 映射到 Tomcat

来源:互联网 发布:淘宝网注册账号手机 编辑:程序博客网 时间:2024/05/22 19:07

Apache 是centos 默认的http服务器
默认使用80端口 ,apache 使用量巨大。
Apache 管理命令

service httpd restart //重启
service httpd start //启动
service httpd stop //停止

配置文件目录

 cd /etc/httpd/conf vi httpd.conf 

配置文件中增加一个虚拟机配置

<VirtualHost *:80>#    ServerAdmin webmaster@dummy-host.example.com#    DocumentRoot /www/docs/dummy-host.example.com#    ServerName dummy-host.example.com#    ErrorLog logs/dummy-host.example.com-error_log#    CustomLog logs/dummy-host.example.com-access_log commonRewriteEngine OnServerName  h.youyisky.comserverAlias www.h.youyisky.comProxyRequests Off<Proxy *>   Order deny,allow  Allow from all</Proxy>#ProxyPass /classifier/ http://172.16.129.22:8080/shiny/#ProxyPassReverse /classifier/ http://172.16.129.22:8080/shiny/#ProxyPass /pic_random/ http://172.16.129.121:8080/#ProxyPassReverse /pic_random/ http://172.16.129.121:8080/ProxyPass / http://localhost:8080/ProxyPassReverse / http://localhost:8080/#SetEnv force-proxy-request-1.0.1#SetEnv proxy-nokeepalive 1</VirtualHost>

配置 主机名

ServerName  www.domain.com:80

如果页面跳转迅速,但是提示临时维护
则查看 SELinux

关闭SELinux的方法:
修改/etc/selinux/config文件中的SELINUX=”” 为 disabled ,然后重启。
如果不想重启系统,使用命令setenforce 0
注:
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式
在lilo或者grub的启动参数中增加:selinux=0,也可以关闭selinux
getenforce/setenforce查看和设置SELinux的当前工作模式

 /usr/sbin/setenforce 0

此配置需要tomcat与apach 在同一主机上方。

场景:公司、校园内网服务需要外网访问

另外配置文件中也支持301跳转

0 0
原创粉丝点击