Forum Moderators: phranque

Message Too Old, No Replies

DOCUMENT ROOT issue with cpanel and WHM

         

asprinwizard

4:34 pm on Feb 11, 2009 (gmt 0)

10+ Year Member



Hello there,

My friend has recently set up a webserver which uses cpanel and WebHost Manager. We are having all sorts of problems setting up the document root for each specific site on the server, not least because I only have access to cpanel for my own sites - and he is not exactly sure how the server should be setup.

Now I'm new to cpanel. My experience of webservers is using ssh commands and setting up virtualshosts as a site definitions for each site. But now I find this fancy GUI but no obvious way to set up $_SERVER parameters.

Anyhow I was finding that absolute paths for my site were not working and further inspection found that it was because the document_root was being set as: /usr/local/apache/htdocs when the root of the site in cpanel was set at /home/sitename.

Now as the domain is not pointing at the new server yet we accessed the site at: [IP...] ADDRESS/~sitename and the site is displaying but obviously it looks wrong because all the paths to the scripts, css and images are looking in the wrong place.

Now usually I would simply have logged in via ssh, edited the vhost .conf file and set the DocumentRoot location and it would be sorted. But with WHM and Cpanel I don't know where to start.

Obviously the httpd.conf file on his server is setting document root to /usr/local/apache/htdocs and maybe the /home directory is being symlinked to this location, but something is obviously not set right. Bear in mind the server is hosting multiple websites all stored in the/home directory. It must be easy enough to sort this.

In desperation I tried setting the DocumentRoot in a .htaccess file but the server doesn't like this and returns a 500 Internal Server Error.

So I'm stuck. I also need to set various sitewide variables such as the php include path and have no idea how to do this with this system.

If anyone can shed any light I'd be most grateful.

shucke

10:24 am on Feb 16, 2009 (gmt 0)

10+ Year Member




System: The following 2 messages were spliced on to this thread from: http://www.webmasterworld.com/apache/3850518.htm [webmasterworld.com] by jdmorgan - 7:11 am on Feb. 16, 2009 <small>(CT -6)</small>


I am in the same situation. Hope someone can help.

I have a host that won't allow ssh or mods to the httpd.conf but I need to configure multiple vhosts to look at one particular shared code base located in one of the vhosts folders.

We have a nicely architected portal CMS that allows all vhosts to use a shared code base. Sweet until you try and put it on a cloud server that doesn't have a main folder for access by all the vhosts or access to httpd.conf. What I would like to do is to point all the vhosts who are looking for the code to look at one main site's folder to get their code. I am not even sure it is possible but the only tool I have is .htaccess.

Perhaps there is some security flaw in this approach and it just is not possible to make it work but in theory it should be possible, shouldn't it?

So, to summarize...

I have two sites...

My cms share code is in /var/www/vhosts/site1.com/htdocs

and site2.com needs to get it's index.pl and all other .pl files from this site1.com folder even though it's document root is set to /var/www/vhosts/site2.com/htdocs

How can I make it work?

The other option is to install the cms into 40 different directories over and over and over just like most of the crappy design PHP applications out there, which, when trying to perform a server wide upgrade is just nonsense.

If what I am trying to do is not possible please, let me know so I don't keep banging my head against the pole and saying ouch, bang, ouch, bang, ouch...

Thank you

[edited by: jdMorgan at 1:13 pm (utc) on Feb. 16, 2009]

[edited by: engine at 9:45 am (utc) on Feb. 17, 2009]
[edit reason] Merged threads, removed site links [/edit]

Caterham

1:07 pm on Feb 16, 2009 (gmt 0)

10+ Year Member



My cms share code is in /var/www/vhosts/site1.com/htdocs

and site2.com needs to get it's index.pl and all other .pl files from this site1.com folder even though it's document root is set to /var/www/vhosts/site2.com/htdocs

How can I make it work?

Symbolic links (symlinks). You can't rewrite outside of the documentroot (except if there are configured aliases) in per-directory context with mod_rewrite.

davec

12:57 am on Feb 17, 2009 (gmt 0)

10+ Year Member



Like Caterham mentioned, symlinks are your friend. We run over 300 Typo3 sites per server off of a single code source. Depending on your server configuration, you may need to open the path to the single source using open_baseline. There is a good overview of symlinks at [en.wikipedia.org...] (I presume wikipedia is ok to link to).

shucke

5:03 am on Feb 17, 2009 (gmt 0)

10+ Year Member



Thanks for the responses. I was afraid that we wouldn't be able to do it without ssh access. We were focused on using <snip> cloud sites, an excellent option for many who use dumb static websites, but for us, our portal system is architected for shared code base and the brilliant minds, and I do mean brilliant in many respects, who came up with the cloud sites system didn't think ahead to consider that you DO NOT install your application 200-300 times on the same system just to support multiple domains running the same application. DOH! All they would have needed to do is make each one of the domain document roots reside under one shared folder, but nooooo, they geniuses, these GIANTS of IT, and don't get me wrong, I really, really respect what they have built, but these einsteins among mortals simply were what, doing their own websites using static pages? thats the only way I can explain it. Or, perhaps they are just used to the crap the php junkies put out that require the entire application be installed and then MAINTAINED in hundreds if not thousands of different domains and folders on the average web hosting plaform.

Again, my thanks to those who answered, may grace smile upon you generously but gently.

[edited by: engine at 9:46 am (utc) on Feb. 17, 2009]
[edit reason] no specific specific hosts, thanks [/edit]