我做了一個簡單的頁面/home/david/mainSite/index.html
。然後,我在Apache中添加了一個虛擬主機,將我的IP地址重定向到此頁面。爲什麼Apache不能將我的IP地址重定向到我的服務器上的所需位置?
<VirtualHost *:80>
ServerName 74.181.105.228
DocumentRoot /home/david/mainSite
</VirtualHost>
然而,當我去74.181.105.228
重啓動Apache後,我得到一個頁面,這個文本,而不是「index.html的。」
Welcome to mydomain.com!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
爲什麼Apache重定向到默認頁面而不是「/home/david/mainSite/index.html」?
以下是我的「/ etc/apache2/sites-available/default」文件的外觀。
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
你有這樣的配置? 'NameVirtualHost *:80' –
是的,我的'ServerName 74.181.105.228'和 'NameVirtualHost *:80'在我的apach2.conf文件中依次排列。 – dangerChihuahua007
你在什麼文件中放置了這個'VirtualHost'塊?你在'access_log'中看到了這些請求嗎?如果您修改日誌配置以包含'Host:'頭('%{Host} i')和規範的'ServerName'('%v'),您是否看到您的期望? – larsks