Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing web root directory

Status
Not open for further replies.

fredrated451

Programmer
Nov 18, 2010
2
0
0
US
I (new to linux and web development, been working in Windows far too long) am trying to configure Apache to work with Drupal. I am doing this on a Suse Linux machine.

I haven't installed Drupal yet, but Drupal documentation says that if you will be installing multiple sites on one machine, the web root directory should be set to public_html. From browsing Apache it seems that this is controlled by the directive DocumentRoot.

The only place I have found a reference to DocumentRoot is in /etc/apache2/default-server.conf, and the initial value after installing apache is /srv/ Since this directory and it's files are owned by root, I logged in as root, created public_html in the file system root, and copied the directories and files already found in /srv/ to public_html.

Then in /etc/apache2 I edited default-server.conf to change the line
DocumentRoot "/srv/to
DocumentRoot "public_html"

Rebooted the Suse Linux machine as the fastest way to restart Apache (i.e., faster than searching for the proper way to restart Apache assuming there is function to restart), but now when I browse to localhost I get a firefox error "Unable to connect Firefox can't establish a connection..." (Originally I got the 'It Works!' message).

One post suggested DocumentRoot needed to be changed in httpd.conf, but /etc/apache2/httpd.conf has no reference to DocumentRoot. So I added the line
DocumentRoot "public_html"
to httpd.conf
However, I still get the firefox 'can't connect' error.

Are there any suggestions on how to properly change the web root directory? Was I correct in thinking this is controlled by DocumentRoot, and if so, how do I properly change it to /public_html?

Thanks in advance for any help. Fred
 
Hi

public_html is the default value of the [tt]UserDir[/tt] directive and indicates the per user document directory. So a request for [ignore][/ignore] will be served from the /home/fredrated451/public_html/ directory.

If you specify a relative path for [tt]DocumentRoot[/tt], like public_html, that will be searched inside the [tt]ServerRoot[/tt]. So it will refer to the /public_html directory only if the [tt]ServerRoot[/tt] is set to / . But that is a bad idea.

Regarding multiple Drupal instances, or generally multiple sites, see the Apache Virtual Host documentation and forget the Per-user web directories.

Feherke.
 
Thanks for the reply
The missing '/' from in front of public_html was a mistake. I added the / and restarted, and firefox got a permissions error, so progress. I gave everyone permission to /public_html, restarted, got "It Work's!", which is progress, except I edited index.html in both directories /public_html and /srv/ so neither of those files is being read, which leaves the question: what is the web root directory?
 
Hi

fredrated451 said:
what is the web root directory?
Both /public_html and /srv/ can be [tt]DocumentRoot[/tt] directories in the same time, for two different virtual hosts.

Take a look at your server's [tt]ErrorLog[/tt] file to see abit detailed explanation of the error.

Feherke.
 
Hi

donb01 said:
if I used your directory it would be /var/www/public_html
Not if we take in consideration the OP's words :
fredrated451 said:
The missing '/' from in front of public_html was a mistake. I added the /
That would mean he set an absolute path, which is not relative to the [tt]ServerRoot[/tt].


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top