Forum Moderators: phranque
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.
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]
My cms share code is in /var/www/vhosts/site1.com/htdocsand 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.
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]