To do HTTPS you need a SSL certificate. Here is how to make a self-signed certificate and get it working in apache. First create the certificate:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mysitename.key -out mysitename.crt
Where mysitename is anything you want it to be, but the actual site name is a good choice. Answer the questions but for Common Name, use the URL of the site. Make a directory to hold the two files:
sudo mkdir /etc/ssl/crt
Then move the two files to that directory
sudo mv mysitename.key /etc/ssl/crt/ sudo mv mysitename.crt /etc/ssl/crt/
Now create a couple of symbolic links in the mods-enabled directory
cd /etc/apache2/mods-enabled ln -s ../mods-available/ssl.conf ssl.conf ln -s ../mods-available/ssl.load ssl.load
Now add a section to /etc/apache2/sites-enabled/000-default
<VirtualHost 192.168.1.49:443> DocumentRoot /srv/www/httpd/ SSLEngine on SSLCertificateFile /etc/ssl/crt/mysitename.crt SSLCertificateKeyFile /etc/ssl/crt/mysitename.key </VirtualHost>
That's it. Now browse to https://192.168.1.49 and see what your visitors will see. When you finish development you will want a real certificate instead of a self-signed one.
![]() |
This site best viewed with a browser |
| Warning: This is a Debian centric site and MAY contain peanuts. | |
| Many thanks to Debra Lynn and Ian Murdock for making Debian possible | |
| First created Mar 21 2011 ~ Last revised June 10, 2011 |