Apache配置同一IP使用多域名对应多个网站
生活随笔
收集整理的這篇文章主要介紹了
Apache配置同一IP使用多域名对应多个网站
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
CentOS下的Apache的配置是/etc/httpd/conf/httpd.conf
vi /etc/httpd/conf/httpd.conf
添加
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName www.test.com
? ? ? ? <Directory "/var/www/html">
? ? ? ? Options Indexes FollowSymLinks
? ? ? ? allow from all
? ? ? ? </Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html/bbs
ServerName bbs.test.com
? ? ? ? <Directory "/var/www/html">
? ? ? ? Options Indexes FollowSymLinks
? ? ? ? allow from all
? ? ? ? </Directory>
</VirtualHost>
vi /etc/httpd/conf/httpd.conf
添加
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName www.test.com
? ? ? ? <Directory "/var/www/html">
? ? ? ? Options Indexes FollowSymLinks
? ? ? ? allow from all
? ? ? ? </Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html/bbs
ServerName bbs.test.com
? ? ? ? <Directory "/var/www/html">
? ? ? ? Options Indexes FollowSymLinks
? ? ? ? allow from all
? ? ? ? </Directory>
</VirtualHost>
然后查找?#NameVirtualHost *:80 將注釋去掉,保存之后,重啟 httpd 服務(wù)就行了。
總結(jié)
以上是生活随笔為你收集整理的Apache配置同一IP使用多域名对应多个网站的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CentOS挂载NTFS移动硬盘
- 下一篇: Xcode7查看iphone真机的应用程