折腾:
期间,OneinStack中安装完毕了vhost了,但是去访问:
和:
都是403:


重启nginx试试:
[root@VM_0_10_centos oneinstack]# service nginx restart Redirecting to /bin/systemctl restart nginx.service
结果:
还是不行。
[root@VM_0_10_centos oneinstack]# ping xxx PING xxx (xxx) 56(84) bytes of data. 64 bytes from xxx: icmp_seq=1 ttl=63 time=4.50 ms 64 bytes from xxx: icmp_seq=2 ttl=63 time=0.260 ms 64 bytes from xxx: icmp_seq=3 ttl=63 time=0.201 ms
和本地:
➜ ~ ping xxx PING xxx (xxx): 56 data bytes 64 bytes from xxx: icmp_seq=0 ttl=49 time=47.557 ms 64 bytes from xxx: icmp_seq=1 ttl=49 time=42.122 ms 64 bytes from xxx: icmp_seq=2 ttl=49 time=42.375 ms
去搜:
OneinStack 403 forbidden
“看看/data/wwwlogs 日志!”
没找到日志,不过去看根目录没问题,所以去拷贝一个进去:
[root@VM_0_10_centos oneinstack]# ll /data/wwwroot/xxx total 0 [root@VM_0_10_centos oneinstack]# ll /data/wwwroot/ total 8 drwxr-xr-x 3 www www 4096 Dec 5 21:52 default drwxr-xr-x 2 www www 4096 Dec 5 22:11 xxx [root@VM_0_10_centos oneinstack]# ll /data/wwwroot/default/ total 108 -rw-r--r-- 1 www www 18081 Dec 5 21:52 index.html -rw-r--r-- 1 www www 20178 Dec 5 21:52 ocp.php -rw-r--r-- 1 www www 19 Dec 5 21:52 phpinfo.php drwxr-xr-x 15 www www 4096 Dec 5 21:59 phpMyAdmin -rw-r--r-- 1 www www 55380 Jan 6 2018 prober.php [root@VM_0_10_centos oneinstack]# cp /data/wwwroot/default/index.html /data/wwwroot/xxx/ [root@VM_0_10_centos oneinstack]# ll /data/wwwroot/default/ total 108 -rw-r--r-- 1 www www 18081 Dec 5 21:52 index.html -rw-r--r-- 1 www www 20178 Dec 5 21:52 ocp.php -rw-r--r-- 1 www www 19 Dec 5 21:52 phpinfo.php drwxr-xr-x 15 www www 4096 Dec 5 21:59 phpMyAdmin -rw-r--r-- 1 www www 55380 Jan 6 2018 prober.php [root@VM_0_10_centos oneinstack]# ll /data/wwwroot/xxx/ total 20 -rw-r--r-- 1 root root 18081 Dec 5 22:19 index.html [root@VM_0_10_centos oneinstack]#
然后再去访问试试
果然就可以了:

【总结】
OneinStack安装vhost的虚拟主机,即添加域名后,访问域名主页,结果403
原因:域名对应网站根目录下没有可供打开的文件(典型的有index.html,index.htm,index.php等等)
解决办法:给根目录加上对应的index.html文件:
cp /data/wwwroot/default/index.html /data/wwwroot/xxx/
就可以看到能正常打开了。
转载请注明:在路上 » 【已解决】OneinStack安装虚拟主机域名vhost后访问主页403 forbidden nginx