Coder Social home page Coder Social logo

ntd0609 / local-cert-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dakshshah96/local-cert-generator

0.0 0.0 0.0 8 KB

๐Ÿš€ A set of scripts to quickly generate a HTTPS certificate for your local development environment.

Shell 100.00%

local-cert-generator's Introduction

HTTPS for localhost

A set of scripts to quickly generate a HTTPS certificate for your local development environment.

How-to

  1. Clone this repository and cd into it:
git clone https://github.com/dakshshah96/local-cert-generator.git
cd local-cert-generator
  1. Run the script to create a root certificate:
sh createRootCA.sh
  1. Add the root certificate we just generated to your list of trusted certificates. This step depends on the operating system you're running:

    • macOS: Open Keychain Access and import the root certificate to your System keychain. Then mark the certificate as trusted.

    Trust root certificate

    • Linux: Depending on your Linux distribution, you can use trust, update-ca-certificates or another command to mark the generated root certificate as trusted.

Note: You may need to restart your browser to load the newly trusted root certificate correctly.

  1. Run the script to create a domain certificate for localhost:
sh createSelfSigned.sh
  1. Move server.key and server.crt to an accessible location on your server and include them when starting it. In an Express app running on Node.js, you'd do something like this:
var path = require('path')
var fs = require('fs')
var express = require('express')
var https = require('https')

var certOptions = {
  key: fs.readFileSync(path.resolve('build/cert/server.key')),
  cert: fs.readFileSync(path.resolve('build/cert/server.crt'))
}

var app = express()

var server = https.createServer(certOptions, app).listen(443)

local-cert-generator's People

Contributors

dakshshah96 avatar adoussot avatar marcgraham avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.