Apache2 如何工作 www.example.com
Apache2 how to working www.example.com
我需要帮助。不好意思写错了。我的 LAMP 服务器我创建了虚拟主机工作 http://example.com a NOT WORKING 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>
考虑到您已经在 /etc/hosts 中放置了到 example.com 的本地映射。您是否也有 www.example.com 的相同条目?
/etc/hosts 条目示例:
127.0.0.1 example.com www.example.com
或
xxx.xxx.xxx.xxxexample.comwww.example.com
(xxx.xxx.xxx.xxx 是您的托管服务器 IP)
我需要帮助。不好意思写错了。我的 LAMP 服务器我创建了虚拟主机工作 http://example.com a NOT WORKING 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>
考虑到您已经在 /etc/hosts 中放置了到 example.com 的本地映射。您是否也有 www.example.com 的相同条目?
/etc/hosts 条目示例:
127.0.0.1 example.com www.example.com
或
xxx.xxx.xxx.xxxexample.comwww.example.com
(xxx.xxx.xxx.xxx 是您的托管服务器 IP)