Apache网络服务器将显示放置到特定位置的文档。该位置的根被称为文档根。
例如,如果DocumentRoot的被设置为/var/www/html
那么将导致/var/www/html/folder1/yourpage.php
被提供给发出请求的客户端
在Ubuntu默认位置在该文件中http://www.yoursite.com/folder1/yourpage.php
的请求/var/www
服务器根在CentOS其/var/www/html
此更改需要重新启动服务。
您可以从/etc/httpd.conf
更改此处,其中有一个关于文档根的部分。
但同样在你的发行版是Ubuntu的其根据/etc/apache2/http.conf
基于Debian的系统
ServerRoot :: /etc/apache2
DocumentRoot :: /var/www
Apache Config Files :: /etc/apache2/apache2.conf
:: /etc/apache2/ports.conf
Default VHost Config :: /etc/apache2/sites-available/default,/etc/apache2/sites-enabled/000-default
Module Locations :: /etc/apache2/mods-available, /etc/apache2/mods-enabled
ErrorLog :: /var/log/apache2/error.log
AccessLog :: /var/log/apache2/access.log
cgi-bin :: /usr/lib/cgi-bin
binaries (apachectl) :: /usr/sbin
start/stop :: /etc/init.d/apache2 (start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean)
来源
2016-01-15 02:02:30
PoX
,因为默认情况下'/ var/www/html'是默认文档根目录。如果您只想使用/ var/www/ –
,则必须在httpd.conf中更改您的配置文件夹的根目录位置为“DocumentRoot”。在我的服务器上,它位于'/ etc/httpd/conf /'中的'httpd.conf'中。 – chris85