虚拟主机 Apache2 不工作
Virtual Host Apache2 doesn't work
我试图将第二个域添加到我的专用服务器。我的标准域 1 应该连接到正常的 /var/www/ 路径,我的第二个域应该指向 /var/www/domain.
更改了一些东西(查看评论),现在我收到 404 错误
我启用的站点配置如下:
默认域:
ServerAdmin 邮件@provider.com
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
</VirtualHost>
第二个域名:
<VirtualHost *:80>
ServerName www.second-domain.net
ServerAlias second-domain.net *.second-domain.net
DocumentRoot /www/domain
</VirtualHost>
主机文件:
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
2a06:1c40::xxx k4lim
::1 localhost
127.0.0.1 localhost
127.0.0.1 domain1.name
185.101.92.XXX domain2.name
T
当我尝试在 Firefox 中打开网站时出现的错误是:找不到域的 DNS 地址。
非常感谢任何想法和帮助!
nslookup domain2.name
显示的 IP 地址是否正确?
ping domain2.name
显示的 IP 地址是否正确?
- 它是本地域还是全球域?如果是本地的,你必须让你的本地 dns 管理员添加它。
- 或者,您可以将其添加到本地计算机上的
/etc/hosts
。不在服务器上。
- 看看
cat /etc/resolv.conf
正确的 dns 服务器是否是 listet。
- 如果是全局域:是否有到外部的连接?
我刚发现我的问题:
<VirtualHost *:80>
ServerName www.second-domain.net
ServerAlias second-domain.net *.second-domain.net
DocumentRoot /www/domain
</VirtualHost>
我忘记了 /var/.... 在 /www/domain
之前
我试图将第二个域添加到我的专用服务器。我的标准域 1 应该连接到正常的 /var/www/ 路径,我的第二个域应该指向 /var/www/domain.
更改了一些东西(查看评论),现在我收到 404 错误
我启用的站点配置如下:
默认域:
ServerAdmin 邮件@provider.com
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
</VirtualHost>
第二个域名:
<VirtualHost *:80>
ServerName www.second-domain.net
ServerAlias second-domain.net *.second-domain.net
DocumentRoot /www/domain
</VirtualHost>
主机文件:
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
2a06:1c40::xxx k4lim
::1 localhost
127.0.0.1 localhost
127.0.0.1 domain1.name
185.101.92.XXX domain2.name
T 当我尝试在 Firefox 中打开网站时出现的错误是:找不到域的 DNS 地址。
非常感谢任何想法和帮助!
nslookup domain2.name
显示的 IP 地址是否正确?ping domain2.name
显示的 IP 地址是否正确?- 它是本地域还是全球域?如果是本地的,你必须让你的本地 dns 管理员添加它。
- 或者,您可以将其添加到本地计算机上的
/etc/hosts
。不在服务器上。 - 看看
cat /etc/resolv.conf
正确的 dns 服务器是否是 listet。 - 如果是全局域:是否有到外部的连接?
我刚发现我的问题:
<VirtualHost *:80>
ServerName www.second-domain.net
ServerAlias second-domain.net *.second-domain.net
DocumentRoot /www/domain
</VirtualHost>
我忘记了 /var/.... 在 /www/domain
之前