Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-30-2012, 02:15 PM   PM User | #1
XmisterIS
Regular Coder

 
Join Date: Jun 2010
Posts: 241
Thanks: 51
Thanked 6 Times in 6 Posts
XmisterIS is an unknown quantity at this point
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..
XmisterIS is offline   Reply With Quote
Old 12-01-2012, 06:46 PM   PM User | #2
stevenmw
Regular Coder

 
stevenmw's Avatar
 
Join Date: Jun 2007
Location: OK
Posts: 449
Thanks: 26
Thanked 30 Times in 30 Posts
stevenmw is an unknown quantity at this point
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/
__________________
--
Thanks!

Last edited by stevenmw; 12-02-2012 at 06:18 AM..
stevenmw is offline   Reply With Quote
Users who have thanked stevenmw for this post:
XmisterIS (12-03-2012)
Old 12-03-2012, 12:14 PM   PM User | #3
XmisterIS
Regular Coder

 
Join Date: Jun 2010
Posts: 241
Thanks: 51
Thanked 6 Times in 6 Posts
XmisterIS is an unknown quantity at this point
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).
XmisterIS is offline   Reply With Quote
Old 12-03-2012, 12:23 PM   PM User | #4
stevenmw
Regular Coder

 
stevenmw's Avatar
 
Join Date: Jun 2007
Location: OK
Posts: 449
Thanks: 26
Thanked 30 Times in 30 Posts
stevenmw is an unknown quantity at this point
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!
stevenmw is offline   Reply With Quote
Old 12-03-2012, 11:45 PM   PM User | #5
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,604
Thanks: 2
Thanked 399 Times in 392 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
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>
Inigoesdr is offline   Reply With Quote
Old 12-03-2012, 11:59 PM   PM User | #6
stevenmw
Regular Coder

 
stevenmw's Avatar
 
Join Date: Jun 2007
Location: OK
Posts: 449
Thanks: 26
Thanked 30 Times in 30 Posts
stevenmw is an unknown quantity at this point
This is way off topic, but I just now realized I typed
Quote:
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!
stevenmw is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:41 AM.


Advertisement
Log in to turn off these ads.