我有一个网站,目的是使用SSL,但有两个条目在Cpanel的httpd.conf似乎是造成问题。 当我只访问www.website.com我需要它去https://www.website.com 。 不过,我必须直接写https://才能工作。 安全站点也有不同的IP。
我不是直接编辑httpd.conf ,也不确定如何更改以下指令:
<VirtualHost 1.1.1.1:80> ServerName website.com ServerAlias www.website.com DocumentRoot /home/websitec/public_html ServerAdmin [email protected] ## User websitec # Needed for Cpanel::ApacheConf <IfModule mod_suphp.c> suPHP_UserGroup websitec websitec </IfModule> <IfModule !mod_disable_suexec.c> <IfModule !mod_ruid2.c> SuexecUserGroup websitec websitec </IfModule> </IfModule> <IfModule mod_ruid2.c> RUidGid websitec websitec </IfModule> CustomLog /usr/local/apache/domlogs/website.com-bytes_log "%{%s}t %I .\n%{%s}t %O ." CustomLog /usr/local/apache/domlogs/website.com combined ScriptAlias /cgi-bin/ /home/websitec/public_html/cgi-bin/ </VirtualHost> <VirtualHost 2.2.2.2:443> ServerName website.com ServerAlias www.website.com DocumentRoot /home/websitec/public_html ServerAdmin [email protected] UseCanonicalName Off CustomLog /usr/local/apache/domlogs/website.com combined CustomLog /usr/local/apache/domlogs/website.com-bytes_log "%{%s}t %I .\n%{%s}t %O ." ## User websitec # Needed for Cpanel::ApacheConf <IfModule mod_suphp.c> suPHP_UserGroup websitec websitec </IfModule> <IfModule !mod_disable_suexec.c> <IfModule !mod_ruid2.c> SuexecUserGroup websitec websitec </IfModule> </IfModule> <IfModule mod_ruid2.c> RUidGid websitec websitec </IfModule> ScriptAlias /cgi-bin/ /home/websitec/public_html/cgi-bin/ SSLEngine on SSLCertificateFile /etc/ssl/certs/www.website.com.crt SSLCertificateKeyFile /etc/ssl/private/www.website.com.key SSLCACertificateFile /etc/ssl/certs/www.website.com.cabundle CustomLog /usr/local/apache/domlogs/website.com-ssl_log combined SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown <Directory "/home/websitec/public_html/cgi-bin"> SSLOptions +StdEnvVars </Directory> # To customize this VirtualHost use an include file at the following location # Include "/usr/local/apache/conf/userdata/ssl/2/websitec/website.com/*.conf" </VirtualHost>
正如你所看到的,在安全的指令之前显然是不安全的指令。 这可能是这个问题,但是如果我尝试在WHM中更改该站点的IP,则会出现IP(2.2.2.2)已在使用中的错误。 这是我猜。
任何帮助表示赞赏。
你的问题还不清楚,你是否应该为同一个网站使用不同的IP地址有两个不同的条目。 我不知道这样的事情甚至可能与cPanel,更不用说独立的服务器(除非你正在运行一些时髦的非标准设置)。 对我来说,这听起来像一个错误/不正确的设置。 我会build议重buildhttpd.conf文件。
cp httpd.conf httpd.conf.backup /usr/local/cpanel/bin/build_apache_conf重buildhttpd.conf文件 service httpd -t或service httpd config-test (取决于您运行的是哪个Apache版本)中是否存在任何错误。 如果事实上我是对的,那么这两个事情就不应该出现,那么这个应该已经解决了。 现在让我们继续安装SSL证书。
基本
Main >> Account Functions >> Change Site's IP Address Main >> SSL/TLS >> Generate a SSL Certificate and Signing Request
Main >> SSL/TLS >> Install a SSL Certificate and Setup the Domain 如果一切正常,则应安装SSL证书,并且http://www.website.com/和https://www.website.com/都应该正常工作。 如果你想设置redirect,这可以在该域的cPanel内完成。