[英]why is it that info.php only work if placed in /var/www/html not /var/www/?
我剛剛部署了LAMP,以准備安裝Elgg。 部署apache和php后,我想通過創建info.php文件來測試進度。 我將文件放在/ var / www /中,並試圖從瀏覽器訪問它,只是得到一個錯誤:
Not Found
The requested URL /info.php was not found on this server.
Apache/2.4.7 (Ubuntu) Server at 192.168.0.9 Port 80
當我在/ var / www / html中放置相同的文件時,它可以工作並顯示Apache和php的安裝設置。 誰能向我解釋為什么? 用於教育目的。
Apache Web服務器將顯示放置在特定位置的文檔。 該位置的根稱為文檔根。
例如,如果DocumentRoot設置為/var/www/html
則對http://www.yoursite.com/folder1/yourpage.php
的請求將導致文件/var/www/html/folder1/yourpage.php
提供給請求客戶
在ubuntu中,服務器根目錄的默認位置是/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)
apache的默認DocumentRoot是/ var / www / html。 編輯位於/etc/apache2
目錄中的httpd.conf配置文件,並將DocumentRoot更改為/ var / www
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.