Changing Default Directory from /usr/apache/htdocs to /home/accountname/public_html

mhernandez84

Member
Mar 23, 2014
8
0
1
cPanel Access Level
Root Administrator
I've searched all over but can't seem to find a correct answer for this.

Right now my server is serving some of my website from /usr/apache/htdocs which shows only errors and some from
/home/account/public_html

how do I bypass usr/apache/htdocs?
 

Infopro

Well-Known Member
May 20, 2003
17,075
524
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
I've searched all over but can't seem to find a correct answer for this.

Right now my server is serving some of my website from /usr/apache/htdocs which shows only errors and some from
/home/account/public_html

how do I bypass usr/apache/htdocs?
Why would you want to do this?

I must be misreading your post. Could you clarify why you're serving a website from /htdocs/?
 

mhernandez84

Member
Mar 23, 2014
8
0
1
cPanel Access Level
Root Administrator
Why would you want to do this?

I must be misreading your post. Could you clarify why you're serving a website from /htdocs/?
I'm not serving the website from /htdocs/ this is something the server configured on its own.

From my httpd.conf

<Directory "/">
AllowOverride All
Options All
</Directory>

<Directory "/usr/local/apache/htdocs">
Options All
AllowOverride None
Require all granted
</Directory>

<VirtualHost xx.xxx.xx.xxx:80>
ServerName xx.xxx.xx.xxx
DocumentRoot /usr/local/apache/htdocs
ServerAdmin [email protected]
<IfModule mod_suphp.c>
suPHP_UserGroup nobody nobody
</IfModule>
UserDir disabled
</VirtualHost>


I tried over riding that in the includes files as it suggests in the httpd.conf file but when i browse to my main domain I get the default cgi-sys/defaultwebpage.cgi page.

When I check the access logs and error logs I get:
/usr/local/apache/htdocs/sites...etc for files its looking for that are in public_html
 

vanessa

Well-Known Member
PartnerNOC
Sep 26, 2006
833
28
178
Virginia Beach, VA
cPanel Access Level
DataCenter Provider
Ok, so, don't do what LostNerd said to do. You shouldn't edit httpd.conf directly, and that concept is plastered all over the cPanel documentation for EasyApache as well as the httpd.conf file itself.

If you want to change the default vhost, it's simple:

1. go into /var/cpanel/templates/apache2

2. copy main.default to main.local

3. edit main.local and change the docroot for the default vhost. If you're using suphp, make sure to adjust the user/group as well

4. run /scripts/rebuildhttpdconf

5. restart apache
 

mhernandez84

Member
Mar 23, 2014
8
0
1
cPanel Access Level
Root Administrator
Ok, so, don't do what LostNerd said to do. You shouldn't edit httpd.conf directly, and that concept is plastered all over the cPanel documentation for EasyApache as well as the httpd.conf file itself.

If you want to change the default vhost, it's simple:

1. go into /var/cpanel/templates/apache2

2. copy main.default to main.local

3. edit main.local and change the docroot for the default vhost. If you're using suphp, make sure to adjust the user/group as well

4. run /scripts/rebuildhttpdconf

5. restart apache
I followed your instructions and when I restarted apache the httpd.conf was unchanged.
 

vanessa

Well-Known Member
PartnerNOC
Sep 26, 2006
833
28
178
Virginia Beach, VA
cPanel Access Level
DataCenter Provider

mhernandez84

Member
Mar 23, 2014
8
0
1
cPanel Access Level
Root Administrator
It the httpd.conf was unchanged, it means you're doing it wrong. The procedure above has worked the dozens of times I've done it. Re-read the instructions. It also wouldn't hurt to read the docs:

EasyApache: The Apache Configuration File & Building Apache

EasyApache: Changes Contained Outside a VirtualHost Directive
About to try it again. I'm using apache 2.4 so I actually need to change the files in that location. I'll be back with an update, thank you, this is the most progress I've made all day!