Apache's Document Root?...

I made some changes to .conf files to have DocumentRoot point to /home/user/NetBeansProjects/Drupal

but, I’m getting a:
[Mon Nov 02 19:55:14 2009] [error] [client] File does not exist: /srv/www/htdocs/drupal

Do I need to create vHost in order for Apache to point to this folder?

  • VcDeveloper1 wrote, On 11/04/2009 09:16 AM:
    > I made some changes to .conf files to have DocumentRoot point to
    > /home/user/NetBeansProjects/Drupal
    > but, I’m getting a:
    > [Mon Nov 02 19:55:14 2009] [error] [client] File does not
    > exist: /srv/www/htdocs/drupal

To me that looks like you didn’t edit the configuration properly.


Modify mod_userdir.conf if you wanna serve pages from a user’s home directory

It’s only necessary to change default-server.conf if you want to redefine the doc root. Then it’s optional to create a virtual-server .conf file in vhosts.d. So which .conf files did you change and/or create? And can you post it/them here.

If you are still having trouble try using YaST which has a module that will let you add a virtual host

(I would undo any changes you made the conf related to document root etc as I found my manual changes aren’t picked up by yast and it might cause some conflicts later on)

Here’s the only changes I made in httpd.conf, just doing a override of the default:

Include /etc/apache2/default-server.conf
Include /etc/apache2/default-server-drupal.conf

Here is my default-server-drupal.conf it’s a copy of default-server.conf, but with changes:

# Global configuration that will be applicable for all virtual hosts, unless
# deleted here, or overriden elswhere.

DocumentRoot "/home/developer/NetBeansProjects/drupal"

# Configure the DocumentRoot
<Directory "/home/developer/NetBeansProjects/drupal">
	# Possible values for the Options directive are "None", "All",
	# or any combination of:
	#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
	# Note that "MultiViews" must be named *explicitly* --- "Options All"
	# doesn't give it to you.
	# The Options directive is both complicated and important.  Please see
	# http://httpd.apache.org/docs-2.2/mod/core.html#options
	# for more information.
	Options +Includes +Indexes +FollowSymLinks
	# AllowOverride controls what directives may be placed in .htaccess files.
	# It can be "All", "None", or any combination of the keywords:
	#   Options FileInfo AuthConfig Limit
	AllowOverride All
	# Controls who can get stuff from this server.
	Order allow,deny
	Allow from all

	# Define your own file limitations on drupal files
	<FilesMatch "(install.php|cron.php|phpinfo.php|update.php|.txt)$">
		Order deny,allow
		Include conf/extra/httpd-ip.conf
		Deny from all
	<FilesMatch "robots.txt">
		Allow from all
	# Read in Drupal default .htaccess file asif conf - easier CVS management
	Include "/home/developer/NetBeansProjects/drupal/.htaccess"


# Sorry, no svn peeking
<DirectoryMatch ".svn">
    # Currently pointing back to drupal
    # High traffic sites might want custom
    # error pages, no need to load drupal
    ErrorDocument 403 /index.php
    Order allow,deny
    Deny from all
    Satisfy All

# Allow the .htaccess files to be used in the sites folder where /files are stored
<Directory "/home/developer/NetBeansProjects/drupal/sites">

# Block off access to admin and devel - just in case you're using on production
# this is very strict because it's limited based on IP addresses
# adjust as needed
<LocationMatch "/(admin|devel)">
	Order deny,allow
	Include "/etc/apache2/httpd-ip.conf"
	Deny from all

# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
<IfModule dir_module>
    DirectoryIndex index.html index.php

# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
#   Satisfy All

# Aliases: aliases can be added as needed (with no limit). The format is 
# Alias fakename realname
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL.  So "/icons" isn't aliased in this
# example, only "/icons/".  If the fakename is slash-terminated, then the 
# realname must also be slash terminated, and if the fakename omits the 
# trailing slash, the realname must also omit it.
# We include the /icons/ alias for FancyIndexed directory listings.  If you
# do not use FancyIndexing, you may comment this out.
Alias /icons/ "/usr/share/apache2/icons/"

<Directory "/usr/share/apache2/icons">
	Options Indexes MultiViews
	AllowOverride None
	Order allow,deny
	Allow from all

# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"

# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
<Directory "/srv/www/cgi-bin">
	AllowOverride None
	Options +ExecCGI -Includes
	Order allow,deny
	Allow from all

# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
# To disable it, simply remove userdir from the list of modules in APACHE_MODULES 
# in /etc/sysconfig/apache2.
<IfModule mod_userdir.c>
	# Note that the name of the user directory ("public_html") cannot simply be
	# changed here, since it is a compile time setting. The apache package
	# would have to be rebuilt. You could work around by deleting
	# /usr/sbin/suexec, but then all scripts from the directories would be
	# executed with the UID of the webserver.
	UserDir public_html
	# The actual configuration of the directory is in
	# /etc/apache2/mod_userdir.conf.
	Include /etc/apache2/mod_userdir.conf
	# You can, however, change the ~ if you find it awkward, by mapping e.g.
	# http://www.example.com/users/karl-heinz/ --> /home/karl-heinz/public_html/ 
	#AliasMatch ^/users/([a-zA-Z0-9-_.]*)/?(.*) /home/$1/public_html/$2

# Include all *.conf files from /etc/apache2/conf.d/.
# This is mostly meant as a place for other RPM packages to drop in their
# configuration snippet.
# You can comment this out here if you want those bits include only in a
# certain virtual host, but not here.
Include /etc/apache2/conf.d/*.conf

# The manual... if it is installed ('?' means it won't complain)
Include /etc/apache2/conf.d/apache2-manual?conf

This is my development server, but to make things easy I would like my Production server to match what I do here. So what is the best way to setup Drupal.

I have it working fine on my Windows server, but changing over to Suse Linux. My development server is a Suse Linux as well as my Pruction Server which is a VirtualBox VM.

By default, your default-server-drupal.conf won’t be included. Better make virtual servers if you intend to run more than one server. Look in vhosts.d for an example file

The existence of two default-server.conf files, named in this:

Include /etc/apache2/default-server.conf
Include /etc/apache2/default-server-drupal.conf
might give the error because you’ve “included” both files.

You should only have (one) default-server.conf in the directory /etc/apache2, and then put two vitual .conf files in /etc/apache2/vhosts.d, one each for the production and development servers.

Step 1: You modify default-server.conf to put the document root at /home/developer/NetBeansProjects

Step2: make a file developer.conf in vhosts.d for the development server located at /home/developer/NetBeansProjects/drupal_devel. The doc root in this .conf file is at …/drupal_devel

Step3: make a file production.conf in vhosts.d for the production server located at /home/developer/NetBeansProjects/drupal_prod

Then you put the developer install of drupal into the directory drupal_devel and the production install of drupal into the directory drupal_prod. The doc root in this .conf file is at …/drupal_prod

For an example of default-server.conf and then subsidiary *.conf virtual server defs see this: HowTo: Configure a Linux Apache Web Server on Suse/openSUSE

Thanks for your reply’s, I will make the changes and get back with you!..