我在服务器上配置新的基于命名的虚拟服务器时遇到了麻烦,我不知道原因,非常欢迎任何帮助......
所以我有一台服务器,其中一个名为 prealp.msh-alpes.fr 的虚拟服务器运行良好。我需要添加一个名为 enquetes-screen.msh-alpes.fr 的新虚拟服务器。我在 /var/www/enquetes-screen 中创建了一个文件,将其 chmod 为 755,然后按如下方式配置其余部分:
我的 /etc/hosts 文件:
127.0.0.1 localhost
195.221.00.00 tyrion.msh-alpes.fr tyrion
195.221.00.00 prealp.msh-alpes.fr prealp
195.221.00.00 enquetes-screen.msh-alpes.fr enquetes-screen.msh-alpes.fr
我的 /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 152.77.00.00
nameserver 195.83.00.00
search msh-alpes.fr enquetes-screen.msh-alpes.fr
这是 /etc/apache2/sites-available/prealp.conf 中的配置文件
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/prealp
ServerName prealp.msh-alpes.fr
<Directory /var/www/prealp>
Options -Indexes
AllowOverride All
</Directory>
LogLevel warn
ErrorLog /var/log/apache2/error-prealp.log
CustomLog /var/log/apache2/access-prealp.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/file
ServerName enquetes-screen.msh-alpes.fr
<Directory /var/www/limesurvey>
Options -Indexes
AllowOverride All
</Directory>
LogLevel warn
ErrorLog /var/log/apache2/error-limesurvey.log
CustomLog /var/log/apache2/access-limesurvey.log combined
</VirtualHost>
NameVirtualHost *:443
<VirtualHost *:443>
ServerAdmin [email protected]
DocumentRoot /var/www/prealp
ServerName prealp.msh-alpes.fr
SSLEngine on
SSLCertificateFile /etc/ssl/certs/cert-28559-prealp.msh-alpes.fr.pem
SSLCertificateKeyFile /etc/ssl/private/prealp.msh-alpes.fr.key
SSLCertificateChainFile /etc/apache2/ssl.crt/chain-28559-prealp.msh-alpes.fr.pem
<Directory /var/www/prealp>
Options -Indexes
AllowOverride All
</Directory>
LogLevel warn
ErrorLog /var/log/apache2/error-prealp-ssl.log
CustomLog /var/log/apache2/access-prealp-ssl.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName
enquetes-screen.msh-alpes.fr
ServerAlias www.enquetes-screen.msh-alpes.fr
ServerAdmin [email protected]
DocumentRoot /var/www/file
SSLEngine on
SSLCertificateFile /etc/ssl/certs/enquetes-screen_msh-alpes_fr.crt
SSLCertificateKeyFile /etc/ssl/private/enquetes-screen.msh-alpes.fr.key
SSLCertificateChainFile /etc/apache2/ssl.crt/DigiCertCA.crt
LogLevel warn
ErrorLog /var/log/apache2/error-enquetes-screen-ssl.log
CustomLog /var/log/apache2/access-enquetes-screen-ssl.log combined
</VirtualHost>
我也尝试将其分成两个 conf 文件 site1.conf 和 newsite.conf,但没有成功
apache2ctl -t
返回语法ok的结果。
然后a2ensite prealp.conf
一切/etc/init.d/apache2 reload
都还好。
apachectl -S
返回结果
VirtualHost configuration:
*:80 is a NameVirtualHost
default server analytics.msh-alpes.fr (/etc/apache2/sites-enabled/analytics.conf:1)
port 80 namevhost analytics.msh-alpes.fr (/etc/apache2/sites-enabled/analytics.conf:1)
port 80 namevhost prealp.msh-alpes.fr (/etc/apache2/sites-enabled/prealp.conf:1)
port 80 namevhost enquetes-screen.msh-alpes.fr (/etc/apache2/sites-enabled/prealp.conf:19)
*:443 is a NameVirtualHost
default server prealp.msh-alpes.fr (/etc/apache2/sites-enabled/prealp.conf:38)
port 443 namevhost prealp.msh-alpes.fr (/etc/apache2/sites-enabled/prealp.conf:38)
port 443 namevhost enquetes-screen.msh-alpes.fr (/etc/apache2/sites-enabled/prealp.conf:61)
alias www.enquetes-screen.msh-alpes.fr
但nslookup enquetes-screen.msh-alpes.fr
仍然回归
** server can't find enquetes-screen.msh-alpes.fr: NXDOMAIN
我已经寻找了一段时间了,但我不知道为什么这不起作用......我是不是遗漏了什么明显的东西?我对此很陌生,所以任何帮助都会非常受欢迎......