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

Re: apache2 and virtual hosts



Hi

On Sat, May 25, 2013 at 10:48:17AM +0100, Pol Hallen wrote:
> Hey all!
> 
> I have read I don't know how much howto but I don't understand how
> resolve virtual host problem.
> 
> I've 2 real domains (i.e. domain1.com, domain2.com, web DNS panel to
> internet is configurated to point to my static IP). Apache works ok.
> 
> PROBLEM: When I do elinks (or with firefox) www.domain1.com or
> www.domain2.com I see only the contents of /var/www/ (that is ok for
> www.domain1.com but www.domain2.com should be show
> /home/domain2/domain2/htdocs/)

Ah.. But "http://www.domain2.com"; is NOT the same as
"http://domain2.com"; - the "www" is merely a common convention. It
actually makes it a different site.

At the technical level, there is nothing wrong with presenting
completely different websites on http://example.com and
http://www.example.com.  Just like "http://example.com"; and
"http://intranet.example.com"; are different sites.

> 
> Thanks for help!
> 
> my conf:
> 
> apache 2.2.16-6+squeeze11
> 
> cat /etc/apache2/site-enabled/001-default:
> 
> <VirtualHost *:80>
>        ServerName domain1.com

No "ServerAlias www.domain1.com" ??

>         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>
> </VirtualHost>
> 
> cat /etc/apache2/site-enabled/domain2
> 
> <VirtualHost *:80>
>         ServerName domain2.com
>         ServerAlias www.domain2.com
>         # Indexes + Directory Root.
>         #DirectoryIndex index.html
>         DocumentRoot /home/domain2/domain2/htdocs/
> </VirtualHost>

Hope this helps

-- 
Karl E. Jorgensen


Reply to: