Re: [users@httpd] multiple vhosts on port 80 and port 443

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

 



Hi Bill,

This might be helpfull.  I have this working on a win2k server.
The following configuration setup enables me to have multiple vhost on port 80 and multiple vhosts on port 443 and I can require login/password or not for either port 80 or port 443.

Hope this is useful.

digger920


Apache2.2.X, SSL, Vhosts

I use include files to make troubleshooting a bit easier.

In httpd.conf

Listen 192.168.10.4:80
Listen 192.168.10.4:443

LoadModule ssl_module modules/mod_ssl.so



# Virtual hosts
Include conf/extra/httpd-vhosts.conf

# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf

<IfModule ssl_module>
SSLMutex default
SSLSessionCache none
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

========================

In httpd-vhosts.conf

NameVirtualHost *:80

<VirtualHost *:80>
   ServerAdmin whoever@where-ever
   ServerName juneau
   DocumentRoot "C:/Server/Apache2.2/htdocs"

   #ErrorLog logs/dummy-host.example.com-error_log
   #CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin whoever@where-ever
   ServerName ASite
   #ServerAlias Test1
   DocumentRoot "C:/Server/Apache2.2/htdocs/www/A-Site"

   #ErrorLog logs/dummy-host2.example.com-error_log
   #CustomLog logs/dummy-host2.example.com-access_log common
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin whoever@where-ever
   ServerName secure
   DocumentRoot "C:/Locked"
   <Directory /Locked>
   AuthType Basic
   AuthName "Locked Test"
   AuthUserFile C:/Server/Apache2.2/htdocs/passwords/pwrd
   Require user testuser
   Order allow,deny
			Allow from all
   </Directory>
   #ErrorLog logs/dummy-host2.example.com-error_log
   #CustomLog logs/dummy-host2.example.com-access_log common
</VirtualHost>

==================================

In httpd-ssl.conf

NameVirtualHost *:443

##  SSL Global Context

AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl

SSLSessionCache        shmcb:c:/server/apache2.2/logs/ssl_scache(512000)
SSLSessionCacheTimeout  300

## SSL Virtual Host Context

<VirtualHost *:443>

#   General setup for the virtual host
		ServerName juneau
		ServerAdmin whoever@where-ever
		DocumentRoot "c:/SecureToo/"

		<Directory /SecureToo>
			Order allow,deny
			Allow from all
		</Directory>


		ErrorLog c:/server/apache2.2/logs/vhost_SSL_error_log.log
		TransferLog c:/server/apache2.2/logs/vhost_SSL_access_log.log


#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on

SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

SSLCertificateFile c:/server/apache2.2/conf/ssl/juneau.crt

SSLCertificateKeyFile c:/server/apache2.2/conf/ssl/juneau.key

SSLCertificateChainFile c:/server/apache2.2/conf/ssl/juneau.crt

<FilesMatch "\.(cgi|shtml|phtml|php)$">
   SSLOptions +StdEnvVars
</FilesMatch>
<Directory "c:/server/apache2.2/cgi-bin">
   SSLOptions +StdEnvVars
</Directory>

BrowserMatch ".*MSIE.*" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0

CustomLog c:/server/apache2.2/logs/ssl_request_log \
         "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>

<VirtualHost *:443>
   ServerAdmin whoever@when-ever
   ServerName secure
   DocumentRoot "C:/Locked/"
# Directory lines only used if you want to do login stuff
   <Directory /Locked>
   AuthType Basic
   AuthName "Locked Test"
   AuthUserFile C:/Server/Apache2.2/htdocs/passwords/pwrd
   Require user user
   Order allow,deny
			Allow from all
   </Directory>
   #ErrorLog logs/dummy-host2.example.com-error_log
   #CustomLog logs/dummy-host2.example.com-access_log common
</VirtualHost>



From: "Bill Angus" <mdangus@xxxxxxxxxxxxx>
Reply-To: users@xxxxxxxxxxxxxxxx
To: <users@xxxxxxxxxxxxxxxx>
Subject: Re: [users@httpd] multiple vhosts on port 80 and port 443
Date: Thu, 19 Oct 2006 10:10:20 -0700

In my Windows 2k environment, there was no way I could manage to get Apache 2 (any version) to listen to port 443 and serve SSL to multiple name-based hosts or even to multiple ip based hosts.

Multiple named hosts work beautifully for me for NON-SSL http service. But I could not manage to set up name-based hosts for an SSL server. This doesn't mean it cannot be done -- only that I tried for over a day and could not make it work :)

Have a great day!

Bill Angus, MA
http://www.psychtest.com

  ----- Original Message -----
  From: Joshua Slive
  To: users@xxxxxxxxxxxxxxxx
  Sent: Thursday, October 19, 2006 10:02 AM
  Subject: Re: [users@httpd] multiple vhosts on port 80 and port 443


  On 10/19/06, Bill Angus <mdangus@xxxxxxxxxxxxx> wrote:

> My solution (ugly as you say), was to set up another instance of apache for > my SSL server on port 443. I suppose if I needed another secure server, I > would use another port and another instance of apache, or I would put the
  > server on port 443 on a different network node.

  Why do you need another instance of apache?  One install can easily
  listen and serve multiple ports.

  Joshua.

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


_________________________________________________________________
Try the next generation of search with Windows Live Search today! http://imagine-windowslive.com/minisites/searchlaunch/?locale=en-us&source=hmtagline


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