I want to install an SSL certificate on my localhost in Ubuntu environment because I can't work on the production server directly. I have to put some conditions in my code on the basis of whether the page is HTTP or HTTPS.
How can I do this?
I want to install an SSL certificate on my localhost in Ubuntu environment because I can't work on the production server directly. I have to put some conditions in my code on the basis of whether the page is HTTP or HTTPS.
How can I do this?
Enable the apache module by typing:
After you have enabled SSL, you'll have to restart the web server for the change to be recognized:
Let's start off by creating a subdirectory within Apache's configuration hierarchy to place the certificate files that we will be making:
Now that we have a location to place our key and certificate, we can create them both in one step by typing:
The questions portion looks something like this:
Open the file with root privileges now:
With the comments removed, the file looks something like this:
In the end, it will look something like this. The entries were modified from the original file:
Save and exit the file when you are finished. Now that we have configured our SSL-enabled virtual host, we need to enable it.
We then need to restart Apache to load our new virtual host file:
That's it now run your site with https..!!