LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-18-2013, 01:45 PM   #1
Ashcor
LQ Newbie
 
Registered: Mar 2012
Location: New Jersey USA
Posts: 17

Rep: Reputation: Disabled
Stumped on Apache2 virtual hosts config....


OpenSUSE 12.3
iRedmail 0.8.5 installed.

So I've built this server and it works fine, I really like the iRedMail BUT......

It changed the default apache2 config files and I can't for the life of me figure out how to get name based virtual websites working.

httpd.conf

Code:
NameVirtualHost *:80


### Global Environment ######################################################
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests.

# run under this user/group id
Include /etc/apache2/uid.conf

# - how many server processes to start (server pool regulation)
# - usage of KeepAlive
Include /etc/apache2/server-tuning.conf

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
ErrorLog /var/log/apache2/error_log

# generated from APACHE_MODULES in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/loadmodule.conf

# IP addresses / ports to listen on
Include /etc/apache2/listen.conf

# predefined logging formats
Include /etc/apache2/mod_log_config.conf

# generated from global settings in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/global.conf

# optional mod_status, mod_info
Include /etc/apache2/mod_status.conf
Include /etc/apache2/mod_info.conf

# optional cookie-based user tracking
# read the documentation before using it!!
Include /etc/apache2/mod_usertrack.conf

# configuration of server-generated directory listings
Include /etc/apache2/mod_autoindex-defaults.conf

# associate MIME types with filename extensions
TypesConfig /etc/apache2/mime.types
DefaultType text/plain
Include /etc/apache2/mod_mime-defaults.conf

# set up (customizable) error responses
Include /etc/apache2/errors.conf

# global (server-wide) SSL configuration, that is not specific to
# any virtual host
Include /etc/apache2/ssl-global.conf

# forbid access to the entire filesystem by default
<Directory />
    Options None
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

# List of resources to look for when the client requests a directory
DirectoryIndex index.html index.html.var

### 'Main' server configuration #############################################
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
Include /etc/apache2/default-server.conf


# Another way to include your own files
#
# The file below is generated from /etc/sysconfig/apache2,
# include arbitrary files as named in APACHE_CONF_INCLUDE_FILES and
# APACHE_CONF_INCLUDE_DIRS
Include /etc/apache2/sysconfig.d/include.conf


### Virtual server configuration ############################################
#
# VirtualHost: 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.
#
Include /etc/apache2/vhosts.d/*.conf


# Note: instead of adding your own configuration here, consider
#       adding it in your own file (/etc/apache2/httpd.conf.local)
#       putting its name into APACHE_CONF_INCLUDE_FILES in
#       /etc/sysconfig/apache2 -- this will make system updates
#       easier :)
default-server.conf

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

DocumentRoot "/srv/www/htdocs"

#
# Configure the DocumentRoot
#
<Directory "/srv/www/htdocs">
        # 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 None
        # 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 None
        # Controls who can get stuff from this server.
Order allow,deny
 Allow from all
</Directory>

# 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
</Directory>

# 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
</Directory>

# 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
</IfModule>


# 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
ServerName linux01.mydomain.com

ServerAdmin admin@mydomain.com
default-vhost.conf

Code:
<VirtualHost _default_:8080>
    ServerName dummy-host.example.com
    ServerAdmin webmaster@dummy-host.example.com
    ServerAlias example.com www.example.com

    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    DocumentRoot "/srv/www/htdocs"

    # if not specified, the global error log is used
    ErrorLog /var/log/apache2/dummy-host.example.com-error_log
    CustomLog /var/log/apache2/dummy-host.example.com-access_log combined

    # don't loose time with IP address lookups
    HostnameLookups Off

    # needed for named virtual hosts
    #UseCanonicalName Off  changed by jeff 9/18/13
    UseCanonicalName Off

    # configures the footer on server-generated documents
    ServerSignature On


    # Optionally, include *.conf files from /etc/apache2/conf.d/
    #
    # For example, to allow execution of PHP scripts:
    #
    # Include /etc/apache2/conf.d/mod_php4.conf
    #
    # or, to include all configuration snippets added by packages:
    # Include /etc/apache2/conf.d/*.conf


    # 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 one, and where ScriptAlias points to.
    #
    <Directory "/srv/www/cgi-bin">
        AllowOverride None
        Options +ExecCGI -Includes
        Order allow,deny
        Allow from all
    </Directory>


    # 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
    </IfModule>


    #
    # This should be changed to whatever you set DocumentRoot to.
    #
    <Directory "/srv/www/htdocs">

        #
        # 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 +Indexes +MultiViews +FollowSymLinks
        IndexOptions FancyIndexing

        #
        # 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 None

        #
        # Controls who can get stuff from this server.
        #
        Order allow,deny
        Allow from all

    </Directory>

    #
    # some Rewrite stuff for sharedssl
    #
    #RewriteEngine on
    ##RewriteLog "/var/log/apache2/dummy-host.example.com-rewrite_log"
    ##RewriteLogLevel 3
    #RewriteCond %{HTTP_HOST} ^sharedssl\.* [OR]
    #RewriteRule ^/$ https://sharedssl.example.com/$1 [L,R]

</VirtualHost>
/etc/apache2/vhosts.d/main.conf

Code:
<VirtualHost *:80>
    UseCanonicalName On
    ServerAdmin admin@mydomain.com
    DocumentRoot "/srv/www/htdocs/mydomain.com"
    ServerName www.mydomain.com
    ServerAlias mydomain.com
    ErrorLog "/var/log/apache2/mydomain.com-error_log"
    CustomLog "/var/log/apache2/mydomain.com-access_log" common
</VirtualHost>
ip-based_vhosts.conf (added by iRedMail I believe)

Code:
<VirtualHost *:443>
 ServerAdmin postmaster@mydomain.com
 DocumentRoot /srv/www/htdocs

    # Enable SSL.
 SSLEngine On
 SSLCertificateFile /etc/apache2/ssl.crt/mydomain.com.crt
 #SSLCertificateFile /etc/ssl/certs/iRedMail_CA.pem
 SSLCertificateKeyFile /etc/apache2/ssl.key/mydomain.com
 #SSLCertificateKeyFile /etc/ssl/private/iRedMail.key

 <Directory />
  Options FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
 </Directory>

 <Directory "/srv/www/htdocs">
  Options Indexes FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
 </Directory>

 ScriptAlias /cgi-bin "/srv/www/cgi-bin"
 <Directory "/srv/www/cgi-bin">
  AllowOverride None
  Options +ExecCGI -Includes
  Order allow,deny
  Allow from all
 </Directory>

 <IfModule mod_userdir.c>
  UserDir public_html
  Include /etc/apache2/mod_userdir.conf
 </IfModule>

 Alias /iredadmin/static "/srv/www/iredadmin/static/"
 WSGIScriptAlias /iredadmin "/srv/www/iredadmin/iredadmin.py/"
 Alias /mail "/srv/www/roundcubemail/"
 Alias /phpmyadmin "/srv/www/htdocs/phpMyAdmin/"
</VirtualHost>

<VirtualHost *:80>
 ServerAdmin postmaster@mydomain.com
 DocumentRoot /srv/www/htdocs/
 ErrorLog /var/log/apache2/
 CustomLog /var/log/apache2/
 HostnameLookups Off
 UseCanonicalName Off
 ServerSignature Off

 <Directory />
  Options FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
 </Directory>

 <Directory "/srv/www/htdocs/">
  Options Indexes FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
 </Directory>

 ScriptAlias /cgi-bin "/srv/www/cgi-bin"
 <Directory "/srv/www/cgi-bin">
  AllowOverride None
  Options +ExecCGI -Includes
  Order allow,deny
  Allow from all
 </Directory>

 <IfModule mod_userdir.c>
  UserDir public_html
  Include /etc/apache2/mod_userdir.conf
 </IfModule>
</VirtualHost>
when I point to the localhost I get a bad request error:

Quote:
Bad request!
Your browser (or proxy) sent a request that
this server could not understand.

If you think this is a server error, please contact
the webmaster.

error 400

linux01.mydomain.com

Wed Sep 18 14:38:00 2013

Apache
what am I missing here? this is driving me nuts...

thanks,

Jeff
 
Old 09-19-2013, 02:34 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Bad request!
Your browser (or proxy) sent a request that
this server could not understand.

If you think this is a server error, please contact
the webmaster.
Most likely you're trying to connect to the server ssl port (443) using http protocol. Try https://servername and see what you get
To check your vhosts, you can run:
Code:
httpd -S
Regards
 
Old 09-19-2013, 05:57 AM   #3
heinblöd
Member
 
Registered: May 2004
Location: France
Distribution: Slackware Gentoo
Posts: 186

Rep: Reputation: 31
Also look into /var/log/apache2/mydomain.com-error_log if it is not the content installed in your vhost which is returning an error.

I would also try to separate the different host physically.
If I'm not mistaken, you use /srw/www/htdocs twice and the mydomain vhost is also inside that structure in /srv/www/htdocs/mydomain.com and Apache may apply options from other vhosts to your mydomain.com vhost

So maybe a layout like
/srv/www/htdocs for the main host
/srv/www/httpsdocs for the ssl host and
/srv/www/vhosts/mydomain.com for the first vhost
would be easier to debug

Last edited by heinblöd; 09-19-2013 at 06:00 AM.
 
Old 09-19-2013, 06:40 AM   #4
Ashcor
LQ Newbie
 
Registered: Mar 2012
Location: New Jersey USA
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by heinblöd View Post
Also look into /var/log/apache2/mydomain.com-error_log if it is not the content installed in your vhost which is returning an error.

I would also try to separate the different host physically.
If I'm not mistaken, you use /srw/www/htdocs twice and the mydomain vhost is also inside that structure in /srv/www/htdocs/mydomain.com and Apache may apply options from other vhosts to your mydomain.com vhost

So maybe a layout like
/srv/www/htdocs for the main host
/srv/www/httpsdocs for the ssl host and
/srv/www/vhosts/mydomain.com for the first vhost
would be easier to debug
That's definitely a cleaner structure. I'll do that.

There is nothing in the mydomain.com-error_log at all. Seems everything gets redirected to ssl (443) and automatically appended with "/mail"

so for instance if you try and go to: http://mydomain.com/ the server redirects you to https://mydomain.com/mail

this is part of the iRedMail modifications and while that's great if all you're running is the iRedMail server, it's problematic if you want to have vhosts and other websites on the server.
 
Old 09-19-2013, 07:14 AM   #5
heinblöd
Member
 
Registered: May 2004
Location: France
Distribution: Slackware Gentoo
Posts: 186

Rep: Reputation: 31
Well you have got
Code:
Alias /mail "/srv/www/roundcubemail/"
But I don't see any config to have "/" redirected to "/mail" ....

any .htaccess file with redirections in place ??

Also I'd swear that there is some kind of rights problem between the vhosts and/or the options directives because if you look at the different
Code:
<Directory "/srv/www/htdocs">
they all have different Options
Code:
 Options ....
And the ip-vhost has a
Code:
AllowOverride None
which could break the redirections

Last edited by heinblöd; 09-19-2013 at 07:17 AM.
 
Old 09-19-2013, 07:23 AM   #6
Ashcor
LQ Newbie
 
Registered: Mar 2012
Location: New Jersey USA
Posts: 17

Original Poster
Rep: Reputation: Disabled
there are .htacess files but they're all in the /srv/www/roundcubemail-0.9.2/ directory or sub-directories thereof.

I don's see where the redirect from http://www.mydomain.com to https://www.mydomain.com/mail get's picked up....

What exactly does:

Code:
AllowOverride None
do? I've read the apache2 docs on it and they're clear as mud... (to me anyway...)

Last edited by Ashcor; 09-19-2013 at 07:25 AM.
 
Old 09-19-2013, 08:14 AM   #7
heinblöd
Member
 
Registered: May 2004
Location: France
Distribution: Slackware Gentoo
Posts: 186

Rep: Reputation: 31
Quote:
Originally Posted by Ashcor View Post
...
What exactly does:

Code:
AllowOverride None
do?
Well nothing I could explain in a few words, but in general you can have "Options" for every folder.

These are "ExecCGI" or "FollowSymlinks" etc .
"FollowSymlinks" is needed e.g to redirect per htaccess .

As you have some kind of inheritance between the parent and child folders, they also can inherit their Options.
Code:
AllowOverride None
says that a child directory cannot override the Options from a parent folder

Code:
AllowOverride All
would allow to override these options.

So for debugging purposes
Code:
AllowOverride All
can be the better choice.

As I said this is a very basic and incomplete explanation
 
Old 09-19-2013, 08:23 AM   #8
Ashcor
LQ Newbie
 
Registered: Mar 2012
Location: New Jersey USA
Posts: 17

Original Poster
Rep: Reputation: Disabled
Ok, that makes sense...

I've made some progress as bathory had suggested I tried

https://www.mydomain.com/ and that did return the index page from /srv/www/htdocs

now

1) why is http (non ssl) not allowed?
2) how do I get it to server up /srv/www/mydomain.com/index.html as opposed to /srv/www/htdocs/index.html
 
Old 09-19-2013, 11:21 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by Ashcor View Post
Ok, that makes sense...

I've made some progress as bathory had suggested I tried

https://www.mydomain.com/ and that did return the index page from /srv/www/htdocs

now

1) why is http (non ssl) not allowed?
2) how do I get it to server up /srv/www/mydomain.com/index.html as opposed to /srv/www/htdocs/index.html
1. There should be some RewriteRule that turns http to https
2. Change the DocumentRoot of the vhost in question to /srv/www/mydomain.com. You may need to use
Code:
<Directory /srv/www/mydomain.com>
Allow from All
</Directory>
as that directory is outside the server default DocumentRoot
 
Old 09-19-2013, 01:17 PM   #10
Ashcor
LQ Newbie
 
Registered: Mar 2012
Location: New Jersey USA
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
1. There should be some RewriteRule that turns http to https
yes but where?

Quote:
2. Change the DocumentRoot of the vhost in question to /srv/www/mydomain.com. You may need to use
Code:
<Directory /srv/www/mydomain.com>
Allow from All
</Directory>
as that directory is outside the server default DocumentRoot
where would I put the <Directory ....> statement? in the mydomain.conf vhost file or back in the man httpd.conf?

I create another vhost:

Code:
<VirtualHost *:80>
    UseCanonicalName On
    ServerAdmin me@mydomain.com
    DocumentRoot "/srv/www/testdomain.com"
    ServerName www.testdomain.com
    ServerAlias testdomain.com
    ErrorLog "/var/log/apache2/testdomain.com-error_log"
    CustomLog "/var/log/apache2/testdomain.com-access_log" common
</VirtualHost>
as expected it only works with https and it only serves up the /srv/www/htdocs/index.html

it's as if it's ignoring name based vhosts and only using ip-based.

I'm thinking my devil is in here...

/etc/apache2/default-vhost.conf

Code:
<VirtualHost _default_:8080>
    ServerName dummy-host.example.com
    ServerAdmin webmaster@dummy-host.example.com
    ServerAlias example.com www.example.com
.
    DocumentRoot "/srv/www/htdocs"
    ErrorLog /var/log/apache2/dummy-host.example.com-error_log
    CustomLog /var/log/apache2/dummy-host.example.com-access_log combined

    HostnameLookups Off
    UseCanonicalName Off
    ServerSignature On
    ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"

    <Directory "/srv/www/cgi-bin">
        AllowOverride None
        Options +ExecCGI -Includes
        Order allow,deny
        Allow from all
    </Directory>


    <IfModule mod_userdir.c>
        UserDir public_html
        Include /etc/apache2/mod_userdir.conf
    </IfModule>
    #
    # This should be changed to whatever you set DocumentRoot to.
    #
    <Directory "/srv/www/htdocs">
        Options +Indexes +MultiViews +FollowSymLinks
        IndexOptions FancyIndexing
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>

Last edited by Ashcor; 09-19-2013 at 01:22 PM. Reason: additional thoughts...
 
Old 09-19-2013, 01:31 PM   #11
Ashcor
LQ Newbie
 
Registered: Mar 2012
Location: New Jersey USA
Posts: 17

Original Poster
Rep: Reputation: Disabled
modified /etc/apache2/vhosts.d/testdomain.conf as follows...

Code:
<VirtualHost *:80>
    UseCanonicalName Off
    ServerAdmin me@mydomain.com
    DocumentRoot "/srv/www/testdomain.com"
    ServerName www.testdomain.com
    ServerAlias testdomain.com
    ErrorLog "/var/log/apache2/testdomain.com-error_log"
    CustomLog "/var/log/apache2/testdomain.com-access_log" common
    <Directory "/srv/www/testdomain.com">
        Options Indexes FollowSymLinks
        AllowOverride None
        Order   allow,deny
        Allow   from all
    </Directory>
</VirtualHost>
still no good... still getting the index from /srv/www/htdocs

/var/log/apache2/access_log only shows

Code:
192.168.1.28 - - [19/Sep/2013:14:33:23 -0400] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0"
the access and error logs for testdomain.com are empty...

did a couple greps of the /etc/apache2 and sub directories and can find no "Redirect" or "Rewrite" statements...

Last edited by Ashcor; 09-19-2013 at 02:26 PM.
 
Old 09-20-2013, 02:25 AM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Are you sure that /etc/apache2/vhosts.d/testdomain.conf is read by apache?
What gives
Code:
httpd -S
 
Old 09-20-2013, 07:04 AM   #13
Ashcor
LQ Newbie
 
Registered: Mar 2012
Location: New Jersey USA
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
Are you sure that /etc/apache2/vhosts.d/testdomain.conf is read by apache?
What gives
Code:
httpd -S
command not found.....
 
Old 09-20-2013, 07:08 AM   #14
Ashcor
LQ Newbie
 
Registered: Mar 2012
Location: New Jersey USA
Posts: 17

Original Poster
Rep: Reputation: Disabled
ok, did a
Code:
/etc/init.d/apache status
and it returned, in part:

Code:
Sep 19 14:47:44 linux01.mydomain.com start_apache2[24338]: [Thu Sep 19 14:47:44 2013] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a Name... results
Sep 19 14:47:44 linux01.mydomain.com start_apache2[24338]: [Thu Sep 19 14:47:44 2013] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a Name... results
Sep 19 14:47:44 linux01.mydomain.com start_apache2[24338]: [Thu Sep 19 14:47:44 2013] [error] VirtualHost *:443 -- mixing * ports and non-* ports with a Nam... results
Sep 19 14:47:44 linux01.mydomain.com start_apache2[24338]: [Thu Sep 19 14:47:44 2013] [warn] NameVirtualHost *:80 has no VirtualHosts

Last edited by Ashcor; 09-20-2013 at 07:43 AM.
 
Old 09-20-2013, 08:10 AM   #15
Ashcor
LQ Newbie
 
Registered: Mar 2012
Location: New Jersey USA
Posts: 17

Original Poster
Rep: Reputation: Disabled
Figured it out... sort of...

/etc/apache2/default-vhost.conf started with this line:

Code:
<VirtualHost _default_:8080>
commented that out and replaced it with:

Code:
<VirtualHost *:8080>
restart Apache and now the individual name based vhosts work...

issue /etc/init.d/apache2 status now gives me this however...

Code:
Sep 20 09:04:12 linux01.ashcortechnologies.com start_apache2[17619]: [Fri Sep 20 09:04:12 2013] [error] VirtualHost *:443 -- mixing * ports and non-* ports with a Nam... results
so something is still wrong somewhere...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which config files must be set for virtual hosts apache2.2.6 bassmanb Linux - Server 4 11-27-2007 11:27 PM
apache2 virtual hosts dave`2005 Ubuntu 1 11-19-2007 07:17 AM
Virtual hosts on apache2 70mas Linux - Server 3 07-16-2007 02:29 AM
Apache2 - need help with virtual hosts bioalchemist Linux - Software 5 08-11-2006 01:24 PM
apache2 virtual hosts viniosity Linux - Software 4 02-07-2004 12:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration