[英]Virtual Host Apache2 doesn't work
I tried to add an second Domain to my dedicated server.我尝试向我的专用服务器添加第二个域。 My standard domain 1 should connect to normal /var/www/ path and my second domain should point to /var/www/domain.我的标准域 1 应该连接到正常的 /var/www/ 路径,而我的第二个域应该指向 /var/www/domain。
Changed some thing (see comments) and now I get an 404 Error改变了一些东西(见评论),现在我收到一个 404 错误
My enabled sites configs look like:我启用的站点配置如下所示:
default domain:默认域:
ServerAdmin mail@provider.com ServerAdmin mail@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>
second domain:第二个域:
<VirtualHost *:80>
ServerName www.second-domain.net
ServerAlias second-domain.net *.second-domain.net
DocumentRoot /www/domain
</VirtualHost>
hosts Document:主机文件:
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 he error I get when I try to open the site in Firefox is: The DNS Adress of the domain could not be found.尝试在 Firefox 中打开站点时出现的错误是:找不到域的 DNS 地址。
Would be really thankful for any ideas and help!非常感谢您的任何想法和帮助!
nslookup domain2.name
show the right IP address? nslookup domain2.name
是否显示正确的 IP 地址?ping domain2.name
show the right IP address? ping domain2.name
是否显示正确的 IP 地址?/etc/hosts
on your local machine.或者,您可以将其添加到本地计算机上的/etc/hosts
。 Not on the server.不在服务器上。cat /etc/resolv.conf
if the right dns server is listet.如果正确的 dns 服务器是 listet,请查看cat /etc/resolv.conf
。I just found my problem:我刚刚发现我的问题:
<VirtualHost *:80>
ServerName www.second-domain.net
ServerAlias second-domain.net *.second-domain.net
DocumentRoot /www/domain
</VirtualHost>
I forgot the /var/.... before /www/domain我忘记了 /www/domain 之前的 /var/....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.