View previous topic :: View next topic |
Author |
Message |
xeonman9000 n00b

Joined: 06 Aug 2008 Posts: 51 Location: UK
|
Posted: Mon Nov 23, 2009 2:25 am Post subject: Apache Virtual Host Issue Woe "Connection to Server Ref |
|
|
Hi,
I'm trying to setup a couple of virtual hosts on a freshly installed Gentoo box but I'm having real difficulty. I've followed a number of guides and just keep getting the following error whenever I try to view a website on my server:
Code: | The requested operation could not be completed
Connection to Server Refused |
This is my 00_default_vhost.conf:
Code: | # Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
<IfDefine DEFAULT_VHOST>
# see bug #178966 why this is in here
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
# Use name-based virtual hosting.
NameVirtualHost *:80
# When virtual hosts are enabled, the main host defined in the default
# httpd.conf configuration will go away. We redefine it here so that it is
# still available.
#
# If you disable this vhost by removing -D DEFAULT_VHOST from
# /etc/conf.d/apache2, the first defined virtual host elsewhere will be
# the default.
<VirtualHost *:80>
ServerName localhost
Include /etc/apache2/vhosts.d/default_vhost.include
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
</IfDefine>
# vim: ts=4 filetype=apache |
I then created a my-domain.com.conf which contains the following:
Code: |
<VirtualHost *:80>
ServerName my-domain.com
ServerAdmin webmaster@my-domain.com
ServerAlias www.my-domain.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.php index.html
DocumentRoot /var/www/my-domain.com/htdocs
<Directory "/var/www/my-domain.com/htdocs">
# http://httpd.apache.org/docs/2.2/mod/core.html#options
Options FollowSymLinks
# Turn on the ability to use .htaccess files.
AllowOverride All
# Controls who can get stuff from this directory.
# http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#order
Order allow,deny
# http://httpd.apache.org/docs/2.2/howto/access.html#host
Allow from all
</Directory>
# Custom log file locations.
LogLevel warn
ErrorLog /var/www/my-domain.com/log/error.log
CustomLog /var/www/my-domain.com/log/custom.log combined
</VirtualHost>
|
I have -D DEFAULT_VHOST in my httpd.conf and I have setup the folder /var/www/my-domain.com/htdocs and can access it by changing the default virtual host's DocumentRoot variable and not having a second vhost defined. |
|
Back to top |
|
 |
coRpTitan n00b

Joined: 21 Aug 2005 Posts: 55 Location: Czech Republic, Brno
|
Posted: Mon Nov 23, 2009 5:47 am Post subject: Re: Apache Virtual Host Issue Woe "Connection to Server |
|
|
xeonman9000 wrote: | I have -D DEFAULT_VHOST in my httpd.conf and I have setup the folder /var/www/my-domain.com/htdocs and can access it by changing the default virtual host's DocumentRoot variable and not having a second vhost defined. |
This can be a problem, this should be defined at: /etc/conf.d/apache2 . There should be something like:
Code: | APACHE2_OPTS="-D DEFAULT_VHOST -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D PHP5" |
Also can you confirm, that directory /var/www/my-domain.com/log/ exists?
Also please post last few lines from:
/var/www/my-domain.com/log/error.log
/var/log/apache2/error_log
when you are starting apache do you get any errors or you can't start apache at all with that configuration? |
|
Back to top |
|
 |
xeonman9000 n00b

Joined: 06 Aug 2008 Posts: 51 Location: UK
|
Posted: Mon Nov 23, 2009 5:16 pm Post subject: |
|
|
** FACEPALM ** I was just getting you the information you requested when I noticed that my new log directory was called "logs" instead of "log" as I specified in my .conf files. It turns out this was causing all my problems.
Thanks for your sort of help anyway.  |
|
Back to top |
|
 |
|