Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
apache2 + vhosts + https [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
decay
n00b
n00b


Joined: 09 Jul 2003
Posts: 36

PostPosted: Wed Feb 16, 2005 10:20 am    Post subject: apache2 + vhosts + https [SOLVED] Reply with quote

hey

I've setup apache2 with vhosts because i'll be hosting multiple domains.
I've managed to setup a virtual domain [url]mail.nexus.netsmart.ro[/url] that works with http but the this is that it doesn't work with https
Here are the vhosts.conf
Code:

# mail
<VirtualHost 81.181.142.4>
        ServerName mail.nexus.netsmart.ro
        ServerAdmin iulian@netsmart.ro
        DocumentRoot /var/www/localhost/htdocs/horde
        Alias /horde /var/www/localhost/htdocs/horde
        #logging section
        ErrorLog /var/log/apache2/errors/nexus.mail.log
        CustomLog /var/log/apache2/access/nexus.mail.log combined
</VirtualHost>


i use the horde/imp/config/motd.php to allow users to chose witch type of connection they want when login to their inbox -http or https.

Code:

$SERVER_SSL_PORT = 443;
$SERVER_HTTP_PORT = 80;
$SERVER_SSL_URL = 'https://mail.nexus.netsmart.ro';
$SERVER_HTTP_URL = 'http://mail.nexus.netsmart.ro';
#
 $port = $_SERVER['SERVER_PORT'];
#
 echo '<br/ ><div align="center" class="light">';
#
 switch ($port) {
     case $SERVER_SSL_PORT:
         echo _("You are currently using Secure HTTPS<br/>");
         break;
#
     case $SERVER_HTTP_PORT:
         echo _("You are currently using Standard HTTP<br/>");
         break;
 }

 echo '<a class="small" href="' . $SERVER_HTTP_URL . '" target="_parent">' . _("Click here for Standard HTTP") . '</a> - <a class="small" href="' . $SERVER_SSL_URL . '" target="_parent">' . _("Click here for Secure HTTPS") . '</a></div>';

but the thing is that when i try to go via https://mail.nexus.netsmart.ro it gives me a nice "The page cannot be displayed" 8O message.

If i try it without the vhosts (the line comented in apache2.conf) it works.

Any ideeas ??


Last edited by decay on Wed Feb 16, 2005 11:10 am; edited 1 time in total
Back to top
View user's profile Send private message
rex123
Apprentice
Apprentice


Joined: 21 Apr 2004
Posts: 272

PostPosted: Wed Feb 16, 2005 10:33 am    Post subject: Reply with quote

You will probably be able to search the forum for info on this.
The main problem is that apache2 is listening on 2 ports now, and you almost certainly have VirtualHost entry problems.
Gentoo has a configuration file called /etc/apache2/conf/modules.d/41_mod_ssl.default-vhost.conf, which is included when you include -D SSL. This contains a <VirtualHost> entry. You are also using another virtualhost entry, and probably you are not specifying the virtual host's port. It might help to have a look at http://httpd.apache.org/docs-2.0/vhosts/ or http://httpd.apache.org/docs/vhosts/name-based.html
Back to top
View user's profile Send private message
decay
n00b
n00b


Joined: 09 Jul 2003
Posts: 36

PostPosted: Wed Feb 16, 2005 11:08 am    Post subject: SOLVED Reply with quote

Thanks for the tip about the /etc/apache2/conf/modules.d/41_mod_ssl.default-vhost.conf file
That did the trick ;)
Code:

<IfDefine SSL>
  <IfModule !mod_ssl.c>
    LoadModule ssl_module    extramodules/mod_ssl.so
  </IfModule>
</IfDefine>

<IfModule mod_ssl.c>

##
## SSL Virtual Host
##
NameVirtualHost mail.nexus.netsmart.ro:443
<VirtualHost mail.nexus.netsmart.ro:443>
    DocumentRoot "/var/www/localhost/htdocs/horde"
    ServerName mail.nexus.netsmart.ro:443
    ServerAdmin iulian@netsmart.ro
    Alias /horde /var/www/localhost/htdocs/horde
    ErrorLog logs/errors/mail_ssl_error_log
    <IfModule mod_log_config.c>
        TransferLog logs/access/mail_ssl_access_log
    </IfModule>
    SSLEngine on
    SSLCipherSuite *****************
    SSLCertificateFile conf/ssl/server.crt
    SSLCertificateKeyFile conf/ssl/server.key
    <Files ~ "\.(cgi|shtml|phtml|php?)$">
        SSLOptions +StdEnvVars
    </Files>
    <Directory "/var/www/localhost/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
    <IfModule mod_setenvif.c>
        SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
    </IfModule>
    <IfModule mod_log_config.c>
        CustomLog logs/access/mail_ssl_request_log \
              "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
    </IfModule>
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteOptions inherit
    </IfModule>
    </VirtualHost>
    </IfModule>


Thanks again
Back to top
View user's profile Send private message
rex123
Apprentice
Apprentice


Joined: 21 Apr 2004
Posts: 272

PostPosted: Wed Feb 16, 2005 11:12 am    Post subject: Re: SOLVED Reply with quote

decay wrote:
[...]
Thanks again


Glad it was useful :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum