Apache 2.4.6 多域名多网站配置
在/etc/httpd/conf 下 编辑
vim httpd.conf
添加:ServerName 外网IP
并注释
#DocumentRoot "/var/www/html/"
在 /etc/httpd/conf.d下 编辑文件
vim httpd-vhosts.conf
内容如下:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.yanwen.mobi
DocumentRoot "/var/www/html/ywapp"
<Directory "/var/www/html/ywapp">
Require all granted
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName doctor.yanwen.mobi
DocumentRoot "/var/www/html/test"
#Alias /course "/var/www/html/test" 取别名
<Directory "/var/www/html/test">
Require all granted
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
#Options +Includes -Indexes
#Options FollowSymLinks
</Directory>
</VirtualHost>
重启程序
systemctl restart httpd
查看状态
systemctl status -l httpd
参考:
http://www.linuxsir.org/linuxfxbsuse/8435.html
http://blog.csdn.net/zhanglei5415/article/details/6821066
前提是 二级域名已经在购买商管理处解析过,可以在/etc/hosts下添加 配置下
在apache中设置访问目录后进入的默认页面为index.php
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
在其中添加index.php,