我需要帮助。对不起写错了。我的LAMP服务器创建了虚拟主机http://example.com 不工作 http://www.exaple.com
<VirtualHost *:80>
DocumentRoot "/var/www/example/1/public_html"
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster@localhost
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
UseCanonicalName on
<Directory "/usr/lib/cgi-bin">
AllowOverride all
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
<Directory "/var/www/example/1/public_html">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
答案 0 :(得分:1)
考虑到您已将本地映射放在/ etc / hosts中的example.com中。您是否也有www.example.com的相同条目?
/ etc / hosts条目的示例:
127.0.0.1 example.com www.example.com
或
xxx.xxx.xxx.xxx example.com www.example.com
(xxx.xxx.xxx.xxx是您的托管服务器IP)