Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a https server on localhost

I followed the tutorial below to create a https server https://docs.nodejitsu.com/articles/HTTP/servers/how-to-create-a-HTTPS-server/

and the program runs without errors

but when I can not open https://localhost:8000 in my chrome

it always get a ERR_SSL_PROTOCOL_ERROR

enter image description here

like image 958
Littlee Avatar asked Apr 28 '17 10:04

Littlee


People also ask

Can localhost have HTTPS?

Sometimes, you need to run your local development site with HTTPS. Tools and tips to do this safely and quickly. Most of the time, http://localhost does what you need: in browsers, it mostly behaves like HTTPS 🔒. That's why some APIs that won't work on a deployed HTTP site, will work on http://localhost .

Can you create an HTTPS Web server?

To create an HTTPS server, you need two things: an SSL certificate, and built-in https Node. js module. We need to start out with a word about SSL certificates. Speaking generally, there are two kinds of certificates: those signed by a 'Certificate Authority', or CA, and 'self-signed certificates'.


1 Answers

Well one quick way to do this is with ngrok.

It's really easy to use and only takes few secs to run. It is as simple as downloading your system version. Unzip and run ngrok.exe. It will open a command line type of window. Make sure your Apache server or the one you use is running.

Then to only listen on an HTTPS tunnel endpoint run the following

ngrok http -bind-tls=true site.dev:80 

or on whatever port you need https to be installed.

Open browser and type https://localhost/myApp you will see it works.

And if you type http://localhost/myApp it also works.

Hope this is helpful to anyone for a fast solution.

like image 144
Balloon Fight Avatar answered Oct 06 '22 03:10

Balloon Fight