Page 1 of 1

multiple HTTP/HTTPS virtualhosts

PostPosted: 26. May 2012 12:51
by alain.roger
Hi,

i have some issues with virtualhosts in http and https on windows 7.
basically i have 2 virtualhost using http/https and setup as following:

Code: Select all
#--------------------------
# website1 with Joomla 2.5
#--------------------------
<VirtualHost *:80>
  DocumentRoot "d:/webserver/www/website1"
  ServerName website1.loc
  ServerAlias www.website1.loc
  ErrorLog "logs/website1.loc.error.log"
  CustomLog "logs/website1.loc.access.log" common
 
  AccessFileName .htaccess
 
  <Directory "d:/webserver/www/website1/">
    AllowOverride All
    Order deny,allow
    Deny from all
    Allow from 192.168.x.x
    Allow from 127.0.0.1
  </Directory>
</VirtualHost>

<VirtualHost website1.loc:443>
  DocumentRoot "d:/webserver/www/website1"
  ServerName website1.loc
  ServerAlias www.website1.loc
  ErrorLog "logs/website1.loc.error.log"
  CustomLog "logs/website1.loc.access.log" common
 
      SSLEngine on 
    SSLCertificateFile conf/ssl.crt/server.crt 
    SSLCertificateKeyFile conf/ssl.key/server.key 
 
  AccessFileName .htaccess
 
  <Directory "d:/webserver/www/website1/">
    AllowOverride All
    Order deny,allow
    Deny from all
    Allow from 192.168.1.x
    Allow from 127.0.0.1
  </Directory>
       
</VirtualHost>

#--------------------------
# website2 with Joomla 2.5
#--------------------------
<VirtualHost *:80>
  DocumentRoot "d:/webserver/www/website2"
  ServerName website2.loc
  ServerAlias www.website2.loc
  ErrorLog "logs/website2.loc.error.log"
  CustomLog "logs/website2.loc.access.log" common
 
  AccessFileName .htaccess
 
  <Directory "d:/webserver/www/website2/">
    AllowOverride All
    Order deny,allow
    Deny from all
    Allow from 192.168.x.x
    Allow from 127.0.0.1
  </Directory>
</VirtualHost>

<VirtualHost website2.loc:443>
  DocumentRoot "d:/webserver/www/website2"
  ServerName website2.loc
  ServerAlias www.website2.loc
  ErrorLog "logs/website2.loc.error.log"
  CustomLog "logs/website2.loc.access.log" common
 
      SSLEngine on 
    SSLCertificateFile conf/ssl.crt/server.crt 
    SSLCertificateKeyFile conf/ssl.key/server.key 
 
  AccessFileName .htaccess
 
  <Directory "d:/webserver/www/website2/">
    AllowOverride All
    Order deny,allow
    Deny from all
    Allow from 192.168.1.x
    Allow from 127.0.0.1
  </Directory>
       
</VirtualHost>


in my host file i have:
www.website1.loc 192.168.1.x
website1.loc 192.168.1.x
www.website2.loc 192.168.1.x
website2.loc 192.168.1.x

1. now when in my browser i type website2.loc i have an error 500
2. if instead of using <VirtualHost *:80> i use <VirtualHost website1.loc:80> and <VirtualHost website2.loc:80> respectively for website1 and website2.... only website1.loc works :(
so where is my mistake ?
thx.

Re: multiple HTTP/HTTPS virtualhosts

PostPosted: 26. May 2012 13:15
by Altrea
Hi alain-roger,

alain.roger wrote:1. now when in my browser i type website2.loc i have an error 500

Take a look into your \xampp\apache\logs\error.log fle

And i don't see your NameVirtualHost directive.
I hope it is there, otherwise namebased virtualhosts can't work.

best wishes,
Altrea

Re: multiple HTTP/HTTPS virtualhosts

PostPosted: 26. May 2012 13:19
by alain.roger
it's like that : NameVirtualHost *:80

Re: multiple HTTP/HTTPS virtualhosts

PostPosted: 29. May 2012 15:04
by JonB
You failed to address the error log issue with regard to the ISE 500 error. That would probably not be caused by improper vhosts entries, but more likely by either a syntax error in a .conf file, or a URL that pointed to an invalid service.

Good Luck
8)