documentroot定位

默认文档root位置/var/www/html第一次安装aches

~]# httpd -S 2>1      VirtualHost configuration:      *:80                   example.com (/etc/httpd/conf.d/example.com.conf:1)      *:443                  is a NameVirtualHost               default server linuxchamber.com (/etc/httpd/conf.d/example.com.conf:26)               port 443 namevhost example.com (/etc/httpd/conf.d/example.com.conf:26)                       alias www.example.com               port 443 namevhost example.com (/etc/httpd/conf.d/ssl.conf:56)      ServerRoot: "/etc/httpd"      Main DocumentRoot: "/var/www/html" <---default location

设置此位置文件/etc/httpd/conf/httpd.conf:

grep-i文档root ed.conf#Documentroot:

注解:如果需要,可选择另一个目录,例如/home/example.com/public_html/.

也可以为单个虚拟主机设置文档根


            
             ServerAdmin
             [email protected]documentroot/var/www/example.com/set服务器Name.comServerAlias
             允许重覆全部
            

注解:虚拟主机目录必须定位到主文档Root下if documentroot/var/www/,
并设置目录下方,如下示例所示:

/var/www/example.com/

修改文件时重新启动Apache命令如下:

od-t服务

folloiwng示例显示,如果有多重 vosts组织并分离文档root

/var/www/vhosts/example.com/vor/www/vhosts/example2.com/var/www/vhosts/example3.com/

Baidu
map