Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I already made a SSL certificate for my server, but can I use the SSL only for specific website.

For example inside /var/www I have a lot web folder and I want the "A" website used HTTPS and the others not used HTTPS.

How to setup?

share|improve this question
    
Do you have virtual hosts configured? –  qbi Feb 28 '13 at 10:14
    
yup..so only for "A" site has HTTPS and the others used HTTP –  ranggadablues Mar 1 '13 at 1:15
add comment

1 Answer

The Apache wiki has a nice page about SSL with Virtual Hosts Using SNI. They describe the setup step by step. I'll write here the main points.

You need OpenSSL version 0.9.8f or later. If you use Ubuntu Hardy Heron (8.04) or later you'll get the correct version. Furthermore OpenSSL should have TLSExtensions enabled. This is the default case since version 0.9.8k (Lucid, 10.04). You Apache version should have SNI support. Have a look into your error.log:

[warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)

If you find the message above SNI is enabled and if you see the message below SNI is not built in.

You should not use name-based virtual hosts in conjunction with SSL

In your default config you should have TLSv1 set as a supported protocol. Look for the variable SSLProtocol. If you don't find any settings, you can add:

SSLProtocol All -SSLv2

This adds supportfor all knowns flavors of SSL and TLS, but not SSL version 2.

Now you have to setup your vrtual host and also maybe activate SSL support (sudo a2ensite ssl plus Apache restart):

<virtualhost *:443>
        SSLEngine On
        SSLCertificateFile /path/to/your/sslcert
        DocumentRoot /path/your/webcontent
</virtualhost>

Furthermore set SSLStrictSNIVHostCheck on in your Apache or vhost config. Now you can restart your Apache and will probably have SSL support. However SNI has lots of pitfalls. If you encounter any errors check your error.log. It might give you advice what went wrong.

The Apache documentation has some detailed description about their SSL support.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.