How to Set Up Your SSL Certificate on Lighttpd in 10 Minutes
Need help setting up your SSL certificate? Check out this tutorial on how to install SSL on the Lighttpd server in under 10 minutes!
Join the DZone community and get the full member experience.
Join For FreeLet's check out this step-by-step SSL installation guide on Lighttpd server.
Step 1: First, you must download the intermediate certificate provided by the CA. You should have received it via email.
Step 2: Once you download the intermedia certificate, copy its contents and paste it into a text editor (i.e. notepad).
Save the file as intermediate.crt.
Step 3: Now, download the x.509 SSL certificate sent by your CA. Save the file as SSL.crt.
It will look something like this:
—–BEGIN CERTIFICATE—–
(SSL Certificate)
—–END CERTIFICATE—–
Step 4: Now, you will need to browse and locate the SSL.crt and .key files that you downloaded. Enter the following command to copy them to your website SSL directory.
# cp ssl.crt /etc/lighttpd/ssl/yourdomain.com
# cp yourdomain.key /etc/lighttpd/ssl/yourdomain.com
Step 5: Once you have entered the aforementioned commands, it’s time to create a .pem file. This can be done by concatenating .key and .crt files. Enter the command below to concatenate and set up the permissions.
# cat yourdomain.key ssl.crt > yourdomain.pem
# chmod 0600 yourdomain.pem
# chown lighttpd:lighttpd /etc/lighttpd/ssl/yourdomain.com -R
Step 6: Open the Lighttpd configuration file using the command below:
# vi /etc/lighttpd/lighttpd.conf
Step 7: Now, you can add the following commands to the configuration section.
$SERVER[“socket”] == “yourdomain.com:443” {
ssl.engine = “enable”
ssl.pemfile = “/etc/lighttpd/yourdomain.com/yourdomain.pem”
ssl.ca-file = “/etc/lighttpd/yourdomain.com/intermediate.crt”
server.name = “yourdomain.com”
server.document-root = “/home/lighttpd/yourdomain.com/https”
server.errorlog = “/var/log/lighttpd/yourdomain.com/serror.log”
accesslog.filename = “/var/log/lighttpd/yourdomain.com/saccess.log”
}
where
ssl.engine = “enable” : Enable lighttpd SSL support
ssl.pemfile = “/etc/lighttpd/yourdomain.com/yourdomain.pem”
ssl.ca-file = “/etc/lighttpd/yourdomain.com/intermediate.crt”
Save and close the file once you’re done.
Step 8: Lastly, you can restart the Lighttpd server using the following command:
# /etc/init.d/lighttpd restart
Published at DZone with permission of S.Prakash Chowdhry. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments