其他分享
首页 > 其他分享> > (5)使用自定Web根目录

(5)使用自定Web根目录

作者:互联网

调整 Web 站点 http://server0.example.com 的网页目录,要求如下:

1) 新建目录 /webroot,作为此站点新的网页文件根目录
# mkdir /webroot
# echo '<h1>wo shi Webroot' > /webroot/index.html

2) 修改配置文件/etc/httpd/conf.d/nsd01.conf
<VirtualHost *:80>
ServerName server0.example.com
DocumentRoot /webroot #修改网页文件根目录
</VirtualHost>

3) 追加写入 /etc/httpd/conf.d/nsd02.conf
<Directory "/webroot">
Require all granted #允许所有
</Directory>

4)SELinux安全上下文(标识,标签)
– chcon [-R] --reference=模板目录 新目录

# ls -Zd /webroot/ #查看目录标签值

# chcon -R --reference=/var/www /webroot/
# ls -Zd /webroot/

5) 重起httpd服务

标签:Web,自定,httpd,webroot,conf,根目录,目录
来源: https://www.cnblogs.com/momo6656/p/14826610.html