Saturday, 12 September 2015

How to manually edit the httpd.conf in cPanel to change the Document Root for configuring SSL certificate for a sub domain?

I have faced this issue after installing an SSL certificate for a sub domain (sub.domain.com). The certificate was correctly installed but it is redirecting to default cPanel page. On further inspection I found out that it was because the Document Root of the https (SSL) version of the sub.domain.com is set to default /usr/local/apache/htdocs .

How to fix this issue? If we edit the DocumentRoot in /usr/local/apache/conf/httpd.conf for the sub.domain.com:443 and then running


/usr/local/cpanel/bin/apache_conf_distiller --update and

/usr/local/cpanel/bin/build_apache_conf

is reverting back the old Document Root which is /usr/local/apache/htdocs .

I was able to fix this issue by editing the corresponding includes file for the sub.domain.com. But there is a twist in the story.

I first tried to edit /var/cpanel/userdata/rank/sub.domain.com but there is no option for SSL certificate. On further inspection I found that, the SSL configuration of sub.domain.com is owned by the user 'nobody'. Then it was a matter of editing corresponding include file for user 'nobody'.

So below given are the exact steps I followed to fix this issue.

Open /var/cpanel/userdata/nobody/sub.domain.com_SSL

Edit the line documentroot: and set it to the correct path.

Run the command : /usr/local/cpanel/bin/apache_conf_distiller --update 

Then run the command :  /usr/local/cpanel/bin/build_apache_conf 

Check the configuration /usr/local/apache/conf/httpd.conf and make sure that configuration is preserved for the sub.domain.com and restart httpd service.

No comments:

Post a Comment