我在家用電腦上建立了一個 lamp (Linux Apache Mysql PHP) 安裝。我下載了一個名為 ilias 的套件並將其解壓縮到文檔根目錄中:
/var/www/ilias
現在當我嘗試按照說明安裝它時http:///ilias/
我看到目錄 ilias 作為 zip 檔案包下載到我的本機電腦。
然而,當我走到實際安裝它的電腦上時,我就在那裡 http://localhost/ilias
然後我就可以看到安裝畫面。
我無法理解為什麼會發生這種情況。以下是我的虛擬主機配置
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot /var/www/
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
~
這是當我訪問機器上的網站時的 apache 日誌,它實際上是 hxxp://localhost
127.0.0.1 - - [04/Feb/2011:22:18:29 +0530] "GET /ilias/templates/default/images/ButtonsBack.gif HTTP/1.1" 304 - "http://localhost/ilias/templates/default/delos.css" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/2009033100 Ubuntu/9.04 (jaunty) Firefox/3.0.8"
但當我這樣做時http://192.168.43.129/ilias/
我在 /var/log/apache2/access.log 中沒有看到任何條目。這個問題最令人驚訝的部分是我在筆記型電腦上執行的 Vmware 中安裝了 Ubuntu。來賓Ubuntu的IP是192.168.43.129,主機Ubuntu的IP是192.168.1.3
答案1
好的,我找到了上述問題的解決方案
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot /var/www
#Remove the 4 lines below had created problem that site started getting downloaded
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
這個配置有效。