Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jun 2010
    Posts
    290
    Thanks
    63
    Thanked 8 Times in 8 Posts

    Can't get SSL working on Apache2.2

    I'm running Apache 2.2 on Debian 6.

    I'm trying to get SSL up and running on my development server (i.e. it's only available on my home LAN), but no dice!

    Interestingly, there are various tutorials out there, many of which seem to be at best slightly incongruent and at worst downright conflicting!

    Mostly, I've been following the tutorial here: http://www.debianadmin.com/install-a...bian-etch.html

    So here's how I get on with it, bit-by-bit. At each stage I am carefully and slowly following the instructions:

    1) Install PHP5 support for apache2 in debian etch. Already done. No need to re-do..

    2) Generate A certificate. Done. No problems.

    3) Enable SSL Support. Done. No problems.

    4) Configuring SSL Certificate to Virtual Hosts in Apache2. Houston, we have a problem!

    Yup, this is where it all starts to go horribly wrong.

    Firstly, there is no line NameVirtualHost * in /etc/apache2/sites-available/default. (See the instructions that I've been using to understand my confusion here).

    So, I put NameVirtualHost *:80 and NameVirtualHost *:443 into /etc/apache2/sites-available/default anyway, and then follow the remaining steps.

    when I try to restart the web server, I get the following error:

    Reloading web server config: apache2[Fri Nov 30 13:54:38 2012] [warn] NameVirtualHost *:443 has no VirtualHosts
    [Fri Nov 30 13:54:38 2012] [warn] NameVirtualHost *:80 has no VirtualHosts


    Of course, the error goes away when I remove the new lines of code in /etc/apache2/sites-available/default, but SSL doesn't work either ...

    Any ideas?

    I'm stumped ...
    Last edited by XmisterIS; 11-30-2012 at 02:36 PM.

  • #2
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts
    The first line in
    /etc/apache2/sites-available/default

    <VirtualHost *:80>

    on line 9 of
    nano /etc/apache2/ports.conf

    NameVirtualHost *:80

    That is where you control the virtual host ports. I change mine for port forwarding. I know SSL only needs 443.

    Read through
    http://www.debian-administration.org/articles/349

    I know there is an interactive module for the terminal to create SSL certificates. i have never used it though.

    I'm running Debian 6.06


    http://www.linuxquestions.org/questi...-linux-596151/
    http://www.thegeekstuff.com/2009/07/...-csr-crt-file/
    Last edited by stevenmw; 12-02-2012 at 06:18 AM.
    Thanks!

  • Users who have thanked stevenmw for this post:

    XmisterIS (12-03-2012)

  • #3
    Regular Coder
    Join Date
    Jun 2010
    Posts
    290
    Thanks
    63
    Thanked 8 Times in 8 Posts
    Perfect! That works nicely.

    I was confused because the configuration of the virtual host ports is split across /etc/apache2/ports.conf and /etc/apache2/sites-available/default

    Do you know why this is? Why not just have it all in the one file? (I've stuck the NameVirtualHost definition for port 443 into the ports file and not the 'default' file).

    Also, and as an aside, why won't AllowOverride in .htaccess work with SSL? (I get a 500 error if I have AllowOverride on the webserver's ssl directory).

  • #4
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts
    Don't quote me on it, but the sites-available folder is for different sites. Apache uses virtual hosting to host multiple sites on a single web-server.

    For the SSL and AllowOverride isue, check out this

    https://help.ubuntu.com/community/En...eHtaccessFiles

    From your previous post I assume you are using Debian, but Ubuntu is based off of it so it should be close.
    Thanks!

  • #5
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Quote Originally Posted by XmisterIS View Post
    Also, and as an aside, why won't AllowOverride in .htaccess work with SSL? (I get a 500 error if I have AllowOverride on the webserver's ssl directory).
    AllowOverride needs to go in one of your Apache conf files. You usually place it right after your VirtualHost directive and inside of the Directory directive that points to your vhost's DocumentRoot. For instance:

    Code:
    NameVirtualHost *:80
    
    <VirtualHost *:80>
    DocumentRoot /home/username/public_html
    ServerName www.example.com
    
    # Other directives here
    
    </VirtualHost>
    
    <Directory "/home/username/public_html">
    AllowOverride All
    </Directory>

  • #6
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts
    This is way off topic, but I just now realized I typed
    nano /etc/apache2/ports.conf
    Lol. I'd edit it, but it won't let me. I guess it is just a habit to type in nano or vim.. Lol.. Now back to the actual topic..
    Thanks!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •