You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Niels Rymenams <nr...@lxit.be> on 2013/12/04 09:07:05 UTC
[users@httpd] Configure 2 virtuals hosts: 1 for a specific subdomain and 1 for as a catch-all
Hi,
I'm sorry for the n00b question, but this is the first time that I need to
configure Apache myself and I can't seem to get my configuration right.
I want to set up a webserver hosting a site (/home/user/www/website) under
a subdomain: website.example.org
Although I want to catch all other requests to the webserver on the domain
and/or subdomains: example.org, host.example.org, www.example.org, ...
I have a default Ubuntu 12.10 installation and have copied the default
configuration in /etc/apache2/sites-available to user-site. I modified both
(only the first few lines defining the ServerName/ServerAlias and
DocumentRoot) using the Apache documentation.
[Configurations are below this e-mail]
When surfing to www.example.org I see the catch-all website, but any other
subdomain goes to the main website.
Any suggestions on what I'm doing wrong?
Kind regards,
Niels R.
------
This is the default configuration (acting as the catch-all):
<VirtualHost *:80>
ServerAdmin webmaster@example.org
ServerName www.example.org
ServerAlias example.org *.example.org
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
------
This is the user-site configuration:
<VirtualHost *:80>
ServerAdmin website@example.org
ServerName website.example.org
DocumentRoot /home/user/www/website
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/niels/www/forum>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
Re: [users@httpd] Configure 2 virtuals hosts: 1 for a specific
subdomain and 1 for as a catch-all
Posted by Niels Rymenams <nr...@lxit.be>.
Thanks a lot! This did the trick!
Niels
On Wed, Dec 4, 2013 at 12:06 PM, Walter H. <wa...@mathemainzel.info>wrote:
> Hi,
>
> these two files have names with numbers,
> give the catch all file a file name that is alphabetical the later one;
> then this works;
>
> Walter
>
> On Wed, December 4, 2013 09:07, Niels Rymenams wrote:
> > Hi,
> >
> > I'm sorry for the n00b question, but this is the first time that I need
> to
> > configure Apache myself and I can't seem to get my configuration right.
> >
> > I want to set up a webserver hosting a site (/home/user/www/website)
> under
> > a subdomain: website.example.org
> > Although I want to catch all other requests to the webserver on the
> domain
> > and/or subdomains: example.org, host.example.org, www.example.org, ...
> >
> > I have a default Ubuntu 12.10 installation and have copied the default
> > configuration in /etc/apache2/sites-available to user-site. I modified
> > both
> > (only the first few lines defining the ServerName/ServerAlias and
> > DocumentRoot) using the Apache documentation.
> > [Configurations are below this e-mail]
> >
> > When surfing to www.example.org I see the catch-all website, but any
> other
> > subdomain goes to the main website.
> >
> > Any suggestions on what I'm doing wrong?
> >
> > Kind regards,
> > Niels R.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: [users@httpd] Configure 2 virtuals hosts: 1 for a specific
subdomain and 1 for as a catch-all
Posted by "Walter H." <wa...@mathemainzel.info>.
Hi,
these two files have names with numbers,
give the catch all file a file name that is alphabetical the later one;
then this works;
Walter
On Wed, December 4, 2013 09:07, Niels Rymenams wrote:
> Hi,
>
> I'm sorry for the n00b question, but this is the first time that I need to
> configure Apache myself and I can't seem to get my configuration right.
>
> I want to set up a webserver hosting a site (/home/user/www/website) under
> a subdomain: website.example.org
> Although I want to catch all other requests to the webserver on the domain
> and/or subdomains: example.org, host.example.org, www.example.org, ...
>
> I have a default Ubuntu 12.10 installation and have copied the default
> configuration in /etc/apache2/sites-available to user-site. I modified
> both
> (only the first few lines defining the ServerName/ServerAlias and
> DocumentRoot) using the Apache documentation.
> [Configurations are below this e-mail]
>
> When surfing to www.example.org I see the catch-all website, but any other
> subdomain goes to the main website.
>
> Any suggestions on what I'm doing wrong?
>
> Kind regards,
> Niels R.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org