UnixServerAdmin

Server Administration & Management

How to Pointing a sub-domain to folder outside public_html in cPanel

When you create a sub-domain, cPanel points it to the corresponding folder under public_html by default. How to point it to a folder outside the public_html, This cannot be done via cPanel/WHM but can be achieved if you have ‘root’ SSH access to the server.

1. Open the apache configuration file — /etc/httpd/conf/httpd.conf
2. Search for the virtual host entry for your sub-domain.
3. Edit the document root of your sub-domain to match the desired location.
4. Save and Exit. Restart apache.

Note: cPanel rebuilds httpd.conf from userdata files and its overwritten on every cPanel update, on every account creation, subdomain addition, or any such activity related to apache & any manual changes you make will be overwritten. To make permanent changes to a subdomain’s root folder :

1. Edit the file /var/cpanel/userdata/username/subdomain.domain.com file, change the path and save it.
2. Run /scripts/rebuildhttpdconf
3. Restart apache.

Advertisements

July 16, 2012 - Posted by | cPanel | ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: