1.apache的安装(httpd-2.2.3.tar.gz上传到目录/usr/local/bycw下)
# cd /usr/local/bycw
# tar xvfz httpd-2.2.3.tar.gz
# cd httpd-2.2.3
# ./configure --prefix=/usr/local/bycw/apache2.2 --enable-mods-shared='proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy_rewrite' --enable-rewrite=shared --enable-module=so
(备注:prefix定义apache的安装路径,必须安装上mod_proxy.so和mod_rewrite.so这两个模块)
# make
# make install
# cd /usr/local/hzcms/apache/bin/
# ./apachectl configtest
显示Syntax ok则表明安装成功
#./apachectl start
在地址栏输入http://ip地址 看到欢迎界面,表示安装成功
# ./apachectl stop
关闭服务
设置apache的开机自启动:
vi /etc/rc.d/rc.local
/usr/local/bycw/apache2.2/bin/apachectl start
2.apache的配置
# cd /usr/local/bycw/apache2.2/conf
vi httpd.conf
(1).修改监听端口:Listen 8080 (apache默认端口为80)
(2). DocumentRoot "/usr/local/bycw/tomcat6.0/webapps/customer"
(3).
Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all (将deny修改成allow)
(4).
(5). # Virtual hosts
#Include conf/extra/httpd-vhosts.conf (去掉这行的#)
3.配置虚拟主机
cd /usr/local/bycw/apache2.2/conf/extra
vi httpd-vhosts.conf
(1)NameVirtualHost *:8080 (这个端口要与apache的监听端口一致)
# ServerAdmin [email protected]
# DocumentRoot /usr/local/bycw/tomcat6.0/webapps/FrontProject
ServerName 127.0.0.1
# ServerAlias www.dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
RewriteEngine On
RewriteRule ^/(.*)$ http://192.168.1.49:8086/$1 [P]
注:RewriteRule ^/(.*)$ http://192.168.1.49:8086/$1 [P]这个ip是重定向的目的地址
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21070542/viewspace-606591/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21070542/viewspace-606591/