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