LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-07-2009, 12:09 PM   #1
keymaster
LQ Newbie
 
Registered: Mar 2009
Posts: 3

Rep: Reputation: 0
Question Apache2 SSL configuration issues - *:80 has no VirtualHosts


Hello all,

I am trying to get SSL working for apache2 (then a proxy, then anyterm)

I am still pretty new to linux in general...

When I /etc/init.d/apache2 restart with the following changes to /etc/apache2/sites-available/default I get:

Restarting web server: apache2[Sat Mar 07 13:03:12 2009] [warn] NameVirtualHost *:80 has no VirtualHosts
... waiting [Sat Mar 07 13:03:13 2009] [warn] NameVirtualHost *:80 has no VirtualHosts
.

I think I might be making an error in the order of my tags but I tried many different configurations: putting namevirutalhost *:443 down between the <VirtualHost> tags i.e. one entry before each set of virtualhosts); I tried <Virtualhost *:80,*:443> (and a dozen variations) but I have to admit I am missing something here. I am just trying to get SSL working.

It seems I'll have to put the file served through 443 in another directory, Will I need to change this line to change the directory, and then just put index.php in there???:
RedirectMatch ^/$ /apache2-default/

I feel I'm missing something base here but I only have a few weeks experience with linux (done ms helpdesk for years) and often lack of exposure just kills me in linux.

THANK YOU!!!




Here's my /etc/apache2/sites-available/default:

Code:
 GNU nano 2.0.7                      File: /etc/apache2/sites-available/default                                                    

NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
        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
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                RedirectMatch ^/$ /apache2-default/
        </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>


</VirtualHost>

<VirtualHost *:443>
        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
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
      </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>

SSLEngine on
SSLCertificateFile /etc/apache2/apache.pem

</VirtualHost>
 
Old 03-07-2009, 12:38 PM   #2
keymaster
LQ Newbie
 
Registered: Mar 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Oh, I think I got it...

NameVirtualHost *:80
NameVirtualHost *:443

and

<VirtualHost *:80>
<VirtualHost *:433>

Appear to be redundant. :P I removed the NameVirtualHost entries and I think I have it working.

Yep, then remove the franky WEIRD RedirectMatch ^/$ /apache2-default/ entry and it now loads /var/www from https://



Thanks!!!

Last edited by keymaster; 03-07-2009 at 12:41 PM.
 
Old 03-07-2009, 01:59 PM   #3
keymaster
LQ Newbie
 
Registered: Mar 2009
Posts: 3

Original Poster
Rep: Reputation: 0
As a followup for searchers what I ended up with was this,

I removed the redirectmatch entry, I was having to load from /var/www/ssl/ssl/ because I doubled it up, and that would have been an ok hack I guess but here's what I had to use,


I think you could use documentroot /var/www/ and then use redirectmatch but that seems like too much.

I added this to virtualhost *:80,

<Directory /var/www/ssl/>
Options Indexes FollowsymLinks MultiViews
AllowOverride None
Order allow,deny
allow from none
</Directory>

And I am using documentroot /var/www/ssl/ under virtualhost *:443

So,

The only way to get to var/www/ssl/ now is to connect securely on 443 - you can't use http://my.domain.com/ssl and you dont even see /ssl/ when visiting https://my.domain.com - it's all transparent.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to configure multiple VirtualHosts with SSL? jnojr Linux - Server 2 01-20-2009 09:10 PM
Apache Multiple SSL VirtualHosts richinsc Linux - Server 4 11-19-2008 11:38 PM
debian with apache2 configuration for many VirtualHosts scottley Linux - Server 0 09-19-2007 01:05 AM
apache2 error - namevirtualhost *:0 has no virtualhosts? tiger.woods Ubuntu 2 04-09-2007 10:26 AM
apache2 - ssl : connection via ssl interrupted ldp Linux - Software 0 10-02-2005 09:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration