此處的403指的是啓動apache的時候彈出的403警告(見下圖),解決方法就是取消ServerName的註釋:php
[root@yolks2 conf]# /usr/local/apache2.4/bin/apachectl start /usr/local/apache2.4/bin/apachectl: 行 79: 6766 段錯誤 $HTTPD -k $ARGV
查看/usr/local/apache2.4/conf/httpd.conf文件,發現以前安裝PHP5和PHP7的時候此處加載了兩個模塊,此處引發的衝突,註釋掉任意一個便可保存文件再次重啓試試。html
啓動狀況:能夠看到此處問題已解決linux
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/usr/local/apache2.4/bin/apachectl -t
/usr/local/apache2.4/bin/apachectl graceful
vi /usr/local/apache2.4/htdocs/test_20171015.php <?php phpinfo(); ?>
正常解析如圖apache
mkdir /data/wwwroot/ mkdir /data/wwwroot/abc.com mkdir /data/wwwroot/111.com
vim /data/wwwroot/abc.com/idnex.php // 編寫測試內容以下 <?php echo "this is test abc.com"; ?>
vim /data/wwwroot/111.com/idnex.php // 編寫測試內容以下 <?php echo "this is test 111.com"; ?>
/usr/local/apache2.4/bin/apachectl -t
/usr/local/apache2.4/bin/apachectl graceful
curl -x192.168.248.129:80 www.abc.com
[root@yolks2 conf]# curl -x192.168.248.129:80 www.abc.com this is test abc.com[root@yolks2 conf]# curl -x192.168.248.129:80 www.111.com this is test abc.com[root@yolks2 conf]# curl -x192.168.248.129:80 www.123.com this is test abc.com
若是咱們訪問 www.example.com 則會指向配置的111.com目錄下的index.php或者經過111.com訪問vim
[root@yolks2 conf]# curl -x192.168.248.129:80 www.example.com this is test 111.com[root@yolks2 conf]#curl -x192.168.248.129:80 111.com this is test 111.com[root@yolks2 conf]#