Some problems with Virtual Host setup and SSL

View: New views
2 Messages — Rating Filter:   Alert me  

Some problems with Virtual Host setup and SSL

by redvivi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello !

        I've some problems with Virtual Hosts on Apache2, please have a look at my config files:

===========================
File sites-enabled/default
===========================

-------------------------------->
NameVirtualHost *
<VirtualHost *>
         ServerAdmin webmaster@localhost

         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>

         ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
         <Directory "/usr/lib/cgi-bin">
                 AllowOverride None
                 Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                 Order allow,deny
                 Allow from all
   </Directory>

         ErrorLog /var/log/apache2/error.log

         # Possible values include: debug, info, notice, warn, error, crit,
         # alert, emerg.
         LogLevel warn

         CustomLog /var/log/apache2/access.log combined
         ServerSignature On

     Alias /doc/ "/usr/share/doc/"
     <Directory "/usr/share/doc/">
         Options Indexes MultiViews FollowSymLinks
         AllowOverride None
         Order deny,allow
         Deny from all
         Allow from 127.0.0.0/255.0.0.0 ::1/128
     </Directory>

     DocumentRoot /var/www/phpmyadmin
     ServerSignature On

     <IfModule mod_ssl.c>
     RewriteEngine on
     RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
     </IfModule>

</VirtualHost>

<---------------------------------------



===============================
File sites-enabled/ssl
================================

-------------------------------------->
NameVirtualHost *:443
<VirtualHost *:443>

# change: address of web admin
ServerAdmin webmaster@localhost
SSLEngine On
SSLCertificateFile /etc/ssl/CA/private/Administration-key-cert.pem

ServerSignature On

  <Directory />
  Options FollowSymLinks
  AllowOverride None
  </Directory>


ProxyHTMLLogVerbose On
ProxyHTMLExtended On


ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /ntop/  https://localhost:3000/
ProxyPassReverse /ntop/  https://localhost:3000/

<-------------------------------------------


When i go to http://server/, it redirects to https://server/ and i have a 404 error.

I just want to redirect http://admin.server/phpmyadmin (not http://server/phpmyadmin byt http://admin.server/phpmyadmin) to https://admin.server/phpmyadmin

I would also redirect the web pages of a software running on localhost:3000 (on the server) to https://admin.server/ntop/

How can i do that ?

Thanks !
Vianney



______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      modssl-users@...
Automated List Manager                            majordomo@...

RE: Some problems with Virtual Host setup and SSL (UNCLASSIFIED)

by Victor, Dwight P CTR DISA PAC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Classification:  UNCLASSIFIED
Caveats: NONE


Hi Vianney,

"When i go to http://server/, it redirects to https://server/ and i have a
404 error."

This is happening because you have this:

     <IfModule mod_ssl.c>
     RewriteEngine on
     RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
     </IfModule>

in your main VirtualHost definition.  If you have SSL enabled, any request
for anything (signified by the ^.*$) would be redirected to the https
server.  Do you have a default page setup?  Check your httpd.conf file to
see what suffixes are set.


"I just want to redirect http://admin.server/phpmyadmin (not
http://server/phpmyadmin byt http://admin.server/phpmyadmin) to
https://admin.server/phpmyadmin"

Does your server have a DNS record for "admin" or do you have something in
your /etc/hosts file that points to "admin?"  This syntax "admin.domain"
usually means that you want to get to the "admin" machine on the "domain"
domain.  To set this up, you have to have something that tells Apache which
machine will answer to the name "admin."  Then you'll want to edit your
rewrite rule to just redirect calls to "admin.domain."

"I would also redirect the web pages of a software running on localhost:3000
(on the server) to https://admin.server/ntop/"

Read up on the use of the mod_rewrite module:

For Apache 1.3 => http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
For Apache 2 => http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

Hope that helps,

Dwight...

---
Dwight Victor, CISSP (Contractor)
DISA-PAC EMSS Gateway Hawaii
EMAIL: dwight.victor.ctr@...
TEL:   (808) 653-3677 ext 229
Classification:  UNCLASSIFIED
Caveats: NONE



smime.p7s (7K) Download Attachment