ckoehler

Member
Aug 7, 2009
15
0
51
Hi,

After a lengthy ordeal with renewing a SSL certificate, I finally got it by editing my httpd.conf manually. The problem is obvious.

Here's the config the way I like it:

Code:
<VirtualHost 12.12.12.12:80> 
    ServerName mydomain.com 
    ServerAlias www.mydomain.com 
    DocumentRoot /home/myuser/public_html 
    ServerAdmin [email protected] 
    UserDir disable 
    Include "/usr/local/apache/conf/userdata/std/2/myuser/mydomain.com/*.conf" 
    ## User myuser # Needed for Cpanel::ApacheConf 
    <IfModule !mod_disable_suexec.c> 
        SuexecUserGroup myuser myuser 
    </IfModule> 
</VirtualHost> 

<VirtualHost 12.12.12.12:443>
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /home/myuser/public_html
    ServerAdmin [email protected]
    UseCanonicalName off
    UserDir public_html
    <IfModule mod_userdir.c>
        Userdir disabled
    </IfModule>
    <IfModule mod_suphp.c>
        suPHP_UserGroup myuser myuser
    </IfModule>
    ## User nobody # Needed for Cpanel::ApacheConf
    CustomLog /usr/local/apache/domlogs/mydomain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ScriptAlias /cgi-bin/ /usr/local/apache/htdocs/cgi-bin/
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/www.mydomain.com.crt
    SSLCertificateKeyFile /etc/ssl/private/www.mydomain.com.key
    SSLCACertificateFile /etc/ssl/certs/www.mydomain.com.cabundle
    CustomLog /usr/local/apache/domlogs/mydomain.com-ssl_log combined
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>
And here's what it makes of it automatically when I run rebuildhttpdconf:

Code:
<VirtualHost 12.12.12.12:80>
    ServerName mydomain.com
    DocumentRoot /usr/local/apache/htdocs
    ServerAdmin [email protected]
    UserDir disable
</VirtualHost>

<VirtualHost 12.12.12.12:443>
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /home/myuser/public_html
    ServerAdmin [email protected]
    UseCanonicalName off
    CustomLog /usr/local/apache/domlogs/mydomain.com combined
    CustomLog /usr/local/apache/domlogs/mydomain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User myuser # Needed for Cpanel::ApacheConf
    UserDir disabled
    UserDir enabled myuser
    <IfModule !mod_disable_suexec.c>
        SuexecUserGroup myuser myuser
    </IfModule>
    ScriptAlias /cgi-bin/ /home/myuser/public_html/cgi-bin/
    SSLEngine on

    SSLCertificateFile /etc/ssl/certs/www.mydomain.com.crt
    SSLCertificateKeyFile /etc/ssl/private/www.mydomain.com.key
        SSLCACertificateFile /etc/ssl/certs/www.mydomain.com.cabundle
    CustomLog /usr/local/apache/domlogs/mydomain.com-ssl_log combined
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
    <Directory "/home/myuser/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/myuser/mydomain.com/*.conf"

</VirtualHost>

Notice the SSL virtualhost is about the same, only a few differences, none too bad. But the non-SSL virtualhost on port 80 is just the default.

How do I make it permanent??

Thanks!

Christoph
 

WebScHoLaR

Well-Known Member
Dec 14, 2005
508
3
168
Planet Earth
Direct changes to httpd.conf will not be preserved as httpd.conf is regenerated based on the information stored in /var/cpanel/userdata. If you need to make changes to SSL Virtual Host, you can make the changes to the virtual host template inside /var/cpanel/templates and then rebuild httpd.conf as /scripts/rebuildhttpdconf and the changes will be applied to httpd.conf. Make sure to restart Apache afterwards.
 

ckoehler

Member
Aug 7, 2009
15
0
51
I understand that. I want to setup my one account in WHM such that I don't need to edit anything. If I had never messed with SSL, creating an account would setup the non-SSL virtualhost just fine. Now that I have SSL, it seems to totally neglect the non-SSL side of things.

How do I tell cPanel that I would like both SSL and non-SSL on that one account?

Christoph
 

ckoehler

Member
Aug 7, 2009
15
0
51
Alright, I fixed this by manually defining the virtualhosts as I want them and including them in the pre_virtualhost include file from inside WHM.

All is working now.

Christoph