我有两个在同一IP地址上运行的站点有问题。 一个作为虚拟主机。 问题是其中一个网站正确加载,如果您使用非www的地址mountainx.com,但如果你去www的地址www.mountainx.com它试图加载其他网站givelocalguide.org的证书。
我暂时通过添加一个redirect到givelocalguide.orgredirect到mountainx.com,但现在我需要开发givelocalguide.org所以必须起飞redirect。 为什么www.mountainx.com的www版本加载不正确的证书? 这两个网站的关系是什么? 为什么不加载该服务器上按字母顺序排列的第一个站点?
任何帮助将不胜感激。
<VirtualHost *:80> ServerAdmin [email protected] ServerName example2.com ServerAlias www.example2.com DocumentRoot /srv/www/example2.com/public_html/ ErrorLog ${APACHE_LOG_DIR}/example2.com_error.log CustomLog ${APACHE_LOG_DIR}/example2.com_access.log combined </VirtualHost> <VirtualHost 199.241.186.58:443> SSLEngine On SSLProtocol all -SSLv2 -SSLv3 SSLCertificateFile /etc/apache2/ssl/342rwqr424.crt SSLCertificateKeyFile /etc/apache2/ssl/example2.com.key SSLCACertificateFile /etc/apache2/ssl/gd_bundle-g2-g1.crt ServerAdmin [email protected] ServerName example2.com DocumentRoot /srv/www/example2.com/public_html/ ErrorLog ${APACHE_LOG_DIR}/example2.com_error_ssl.log CustomLog ${APACHE_LOG_DIR}/example2.com_access_ssl.log combined </VirtualHost> root@hiphop:/etc/apache2/sites-available# vi example.com <VirtualHost *:80> ServerAdmin [email protected] ServerName example.com ServerAlias www.example.com ServerAlias hammer.example.com DocumentRoot /srv/www/example.com/public_html/ ErrorLog ${APACHE_LOG_DIR}/example.com_error.log CustomLog ${APACHE_LOG_DIR}/example.com_access.log combined </VirtualHost> <VirtualHost 199.241.186.58:443> SSLEngine On SSLProtocol all -SSLv2 -SSLv3 SSLCertificateFile /etc/apache2/ssl/342ew4233.crt SSLCertificateKeyFile /etc/apache2/ssl/example.com.key SSLCACertificateFile /etc/apache2/ssl/gd_bundle-g2-g1.crt ServerAdmin [email protected] ServerName example.com DocumentRoot /srv/www/example.com/public_html/ ErrorLog ${APACHE_LOG_DIR}/example.com_error_ssl.log CustomLog ${APACHE_LOG_DIR}/example.com_access_ssl.log combined </VirtualHost>
如果您发布的configuration是准确的,则表示您缺less:
ServerAlias http://www.example.org
在你的虚拟主机configuration。 假设你的mountainx.com证书是为godaddy而设置的,你应该是好的。
更多细节: https : //httpd.apache.org/docs/2.4/mod/core.html#serveralias