I have a LAMP stack running. My the web root is /var/www
.
So if I go to http://linux-server/some/page.php
It renders the page located at /var/www/some/page.php
If I use https
I get page not found.
I would like to enable SSL for all pages, so I can view any of these pages using either http or https.
How can I do that?
/etc/apache2/sites-available/default-ssl
has the configuration for an http server. It can be enabled with the commandsudo a2ensite default-ssl
.You will also need to enable mod ssl. This can be done with the command
sudo a2enmod ssl
. This will point you to/usr/share/doc/apache2.2-common/README.Debian.gz
for directions on configuring SSL and generting a self-signed certificate. it can be viewed with the commandzless /usr/share/doc/apache2.2-common/README.Debian.gz
Once you have the certificates installed, you can restart apache with the command
sudo /etc/init.d/apache2 restart
.You can add it within apache or add it with a proxy (like nginx). I prefer setting up an SSL proxy locally or remotely in the first place. This way if I need to install a WAF or IDS later, there are less modifications required.