Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you use https / SSL on localhost?

I would like to know how to setup SSL on my web application on the localhost.

I have no background in doing this, would appreaciate guidance. I already finished implementing my web application and i need it to use https on the localhost or while I host it on a server.

Any Ideas?

Regards.

like image 884
HShbib Avatar asked May 03 '11 19:05

HShbib


People also ask

Can you have HTTPS on localhost?

Most of the time, you can trust http://localhost to behave like an HTTPS site. But in some cases, you need to run your site locally with HTTPS.

How do I run SSL?

Under Install and Manage SSL for your site (HTTPS), click Manage SSL Sites. Scroll down to the Install an SSL Website and click Browse Certificates. Select the certificate that you want to activate and click Use Certificate. This will auto-fill the fields for the certificate.

How do I use HTTPS on localhost IIS?

Solve this by starting mmc.exe . The final step is to open Internet Information Services (IIS) Manager or simply inetmgr.exe . From there go to your site, select Bindings... and Add... or Edit... . Set https and select your certificate from the drop down.


2 Answers

If you have IIS Express (with Visual Studio):

To enable the SSL within IIS Express, you have to just set “SSL Enabled = true” in the project properties window.

See the steps and pictures at this code project.

IIS Express will generate a certificate for you (you'll be prompted for it, etc.). Note that depending on configuration the site may still automatically start with the URL rather than the SSL URL. You can see the SSL URL - note the port number and replace it in your browser address bar, you should be able to get in and test.

From there you can right click on your project, click property pages, then start options and assign the start URL - put the new https with the new port (usually 44301 - notice the similarity to port 443) and your project will start correctly from then on.

enter image description here

like image 93
JackArbiter Avatar answered Sep 23 '22 00:09

JackArbiter


It is easy to create a self-signed certificate, import it, and bind it to your website.

1.) Create a self-signed certificate:

Run the following 4 commands, one at a time, from an elevated Command Prompt:

cd C:\Program Files (x86)\Windows Kits\8.1\bin\x64  makecert -r -n "CN=localhost" -b 01/01/2000 -e 01/01/2099 -eku 1.3.6.1.5.5.7.3.3 -sv localhost.pvk localhost.cer  cert2spc localhost.cer localhost.spc  pvk2pfx -pvk localhost.pvk -spc localhost.spc -pfx localhost.pfx 

2.) Import certificate to Trusted Root Certification Authorities store:

start --> run --> mmc.exe --> Certificates plugin --> "Trusted Root Certification Authorities" --> Certificates

Right-click Certificates --> All Tasks --> Import Find your "localhost" Certificate at C:\Program Files (x86)\Windows Kits\8.1\bin\x64\

3.) Bind certificate to website:

start --> (IIS) Manager --> Click on your Server --> Click on Sites --> Click on your top level site --> Bindings

Add or edit a binding for https and select the SSL certificate called "localhost".

4.) Import Certificate to Chrome:

Chrome Settings --> Manage Certificates --> Import .pfx certificate from C:\certificates\ folder

Test Certificate by opening Chrome and navigating to https://localhost/

like image 24
Jason Williams Avatar answered Sep 24 '22 00:09

Jason Williams