The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'EasyApache' started by mhernandez84, Mar 28, 2014.

  1. mhernandez84

    mhernandez84 Member

    Joined:
    Mar 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    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?
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,469
    Likes Received:
    197
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Why would you want to do this?

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

    mhernandez84 Member

    Joined:
    Mar 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    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 xxxx@gmail.com
    <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
     
  4. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    817
    Likes Received:
    22
    Trophy Points:
    18
    Location:
    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
     
  5. mhernandez84

    mhernandez84 Member

    Joined:
    Mar 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I followed your instructions and when I restarted apache the httpd.conf was unchanged.
     
  6. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    817
    Likes Received:
    22
    Trophy Points:
    18
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
  7. mhernandez84

    mhernandez84 Member

    Joined:
    Mar 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    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!
     
  8. mhernandez84

    mhernandez84 Member

    Joined:
    Mar 23, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page