4. 配置apache
如下,找到httpd.conf文件
- [root@i001 conf]# pwd
- /etc/httpd/conf
- [root@i001 conf]# ll
- total 60
- -rw-r--r-- 1 root root 33980 Aug 18 10:07 httpd.conf
- -rw-r--r-- 1 root root 13139 May 4 18:54 magic
打开httpd.conf文件找到如下配置:
- # Use name-based virtual hosting.
- #NameVirtualHost *:80
- #
- # NOTE: NameVirtualHost cannot be used without a port specifier
- # (e.g. :80) if mod_ssl is being used, due to the nature of the
- # SSL protocol.
将红色部分#号去掉,如下:
- # Use name-based virtual hosting.
- NameVirtualHost *:80
- #
- # NOTE: NameVirtualHost cannot be used without a port specifier
- # (e.g. :80) if mod_ssl is being used, due to the nature of the
- # SSL protocol.
- <VirtualHost *:80>
- ServerName www.linuxidc.com
- ProxyPass / http://www.linuxidc.com:8080/
- ProxyPassReverse / http://www.linuxidc.com:8080/
- </VirtualHost>
- <VirtualHost *:80>
- ServerName www.domianb.com
- ProxyPass / http://www.linuxidc.net:9080/
- ProxyPassReverse / http://www.linuxidc.net:9080/
- </VirtualHost>
- [root@i001 conf]# service httpd restart
- [root@i001 logs]# pwd
- /etc/httpd/logs
