Re: VirtualHost? or redirects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2009-09-17 at 14:27 +0000, Ralf W. wrote:
> Hello Group.  I'm trying to understand the following setup.
> I have a main server, www.somedomain.com
> [DocumentRoot /var/www/www.somedomain.com/htdocs/], within the server
> I want to redirect to specific pages by using www2.somedomain.com,
> what then points to
> [DocumentRoot /var/www/www.somedomain.com/htdocs/www2_redirect/].
> I'm using Debian 4.08/apache2.  My questions is, is this a VirtualHost
> setup, or redirects.  I tried the virtual host setup and it never goes
> to the www2 virtual site. Why is that?  How to do this the correct
> way?
> 
> .../sites-available/default:
> NameVirtualHost www2.somedomain.com:80

This is wrong: should be NameVirtualHost *:80

> 
> .../sites-available# more www2.somedomain.com
> <VirtualHost www2.somedomain.com:80>
Again, <VirtualHost *:80>
>         ServerName www2.somedomain.com
>         ServerAdmin me@xxxxxxxxxxxxxx
> 
>         # Indexes + Directory Root.
>         DirectoryIndex index.html
>         DocumentRoot /var/www/www.somedomain.com/htdocs/www2_redirect/
> 
>         # CGI Directory
>         ScriptAlias /cgi-bin/ /var/www/www.somedomain.com/cgi-bin/
>         <Location /cgi-bin>
>                 Options +ExecCGI
>         </Location>
>         RewriteEngine On
>         RewriteCond %{REQUEST_METHOD} ^TRACE
>         RewriteRule .* - [F]
>         RewriteCond %{REQUEST_METHOD} ^TRACK
>         RewriteRule .* - [F]
> 
>         # Logfiles
>         SetEnvIf Request_URI "^/check.txt$" dontlog
>         ErrorLog /var/log/apache2/www2-somedomain.com-error_log
>         CustomLog /var/log/apache2/www2.somedomain.com-access_log combined env=!dontlog
> </VirtualHost>
> 
> 
> main site:  www.somedomain.com works, and if I point the browser to
> www2, I'm still getting the www. page.  I must do something wrong???
> 
> .../sites-available# more www.somedomain.com
> <VirtualHost www.somedomain.com:80>
and here as well, <VirtualHost *:80>
>         ServerName www.somedomain.com
>         ServerAdmin me@xxxxxxxxxxxxxx
> 
>         # Indexes + Directory Root.
>         DirectoryIndex index.html
>         DocumentRoot /var/www/www.somedomain.com/htdocs/
> 
>         # CGI Directory
>         ScriptAlias /cgi-bin/ /var/www/www.somedomain.com/cgi-bin/
>         <Location /cgi-bin>
>                 Options +ExecCGI
>         </Location>
> 
>         # disable TRACE and TRACK in the www.example.com virtual host
>         RewriteEngine On
>         RewriteCond %{REQUEST_METHOD} ^TRACE
>         RewriteRule .* - [F]
>         RewriteCond %{REQUEST_METHOD} ^TRACK
>         RewriteRule .* - [F]
> 
>         # Logfiles
>         SetEnvIf Request_URI "^/check.txt$" dontlog
>         ErrorLog /var/log/apache2/www.somedomain.com-error_log
>         CustomLog /var/log/apache2/www.somedomain.com-access_log combined  env=!dontlog
> </VirtualHost>
> 
> 
> <VirtualHost www.somedomain.com:443>
This is right though :)
>         ServerName www.somedomain.com
>         ServerAdmin me@xxxxxxxxxxxxxx
> 
>         # Indexes + Directory Root.
>         DirectoryIndex index.html
>         DocumentRoot /var/www/www.somedomain.com/htdocs/
> 
>         # CGI Directory
>         ScriptAlias /cgi-bin/ /var/www/www.somedomain.com/cgi-bin/
>         <Location /cgi-bin>
>                 Options +ExecCGI
>         </Location>
> 
>         # disable TRACE and TRACK in the www.example.com virtual host
>         RewriteEngine On
>         RewriteCond %{REQUEST_METHOD} ^TRACE
>         RewriteRule .* - [F]
>         RewriteCond %{REQUEST_METHOD} ^TRACK
>         RewriteRule .* - [F]
> 
>         # Logfiles
>         SetEnvIf Request_URI "^/check.txt$" dontlog
>         ErrorLog /var/log/apache2/www.somedomain.com-error_log
>         CustomLog /var/log/apache2/www.somedomain.com-access_log combined  env=!dontlog
> 
>         SSLEngine on
>         SSLCertificateChainFile /etc/apache2-ssl/ca.crt
>         SSLCertificateKeyFile /etc/apache2-ssl/ls2.somedomain.com.key
>         SSLCertificateFile /etc/apache2-ssl/ls2.somedomain.com.crt
> </VirtualHost>
> 
> 
> Thank you
> Ralf



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux