GithubHelp home page GithubHelp logo

How to use on Windows about mkcert HOT 16 CLOSED

filosottile avatar filosottile commented on May 11, 2024 5
How to use on Windows

from mkcert.

Comments (16)

xyzdata avatar xyzdata commented on May 11, 2024 4

docs for windows is wanted.

from mkcert.

ivangretsky avatar ivangretsky commented on May 11, 2024 4

I am using xampp portable with apache web server.

Was just writing a long post about how nothing works, checking one step after another, and realized that I did not tell apache to use the certificates issued. I changed virtual host config for a site as shown below, and it started working!

<VirtualHost *:443>
    DocumentRoot "D:/xampp/htdocs/test.xyz"
    ServerName test.xyz
    ServerAlias *.test.xyz
	
    SSLEngine on	
    SSLCertificateFile "c:\Users\XXX\test.xyz.pem"
    SSLCertificateKeyFile "c:\Users\XXX\test.xyz-key.pem"
</VirtualHost>

It is in xampp\apache\conf\extra\httpd-vhosts.conf in my case for xampp.

Thanks @adamdecaf and @aweber1!

Wildcard for 2nd level domains don't work in Chrome though.

from mkcert.

xgqfrms avatar xgqfrms commented on May 11, 2024 1

image

OK

https & express sever

const https = require('https');
const express = require('express');
const fs = require('fs');

// const fs = require('fs');

// OpenSSL
// const privateKey = fs.readFileSync('./https-ssl/server.key');
// const certificate = fs.readFileSync('./https-ssl/server.crt');

// pem
const privateKey = fs.readFileSync('./ssl/webgeeker.xyz+3-key.pem');
const certificate = fs.readFileSync('./ssl/webgeeker.xyz+3.pem');

const credentials = {
    key: privateKey,
    cert: certificate,
};

const app = express();
// const app = express.createServer(credentials);
// https://localhost:8888

https.createServer(credentials, app).listen(8888);

app.get('/', function (req, res) {
    console.log('req =', req);
    res.header('Content-type', 'text/html');
    return res.end('<h1>Hello, HTTPS!</h1>');
});

from mkcert.

xgqfrms avatar xgqfrms commented on May 11, 2024

what's wrong with this ?

C:\Users\xxx\AppData\Local\mkcert

image

from mkcert.

ivangretsky avatar ivangretsky commented on May 11, 2024

@xgqfrms, see 1 and 2 in my original post. Real problems start later)

from mkcert.

xgqfrms avatar xgqfrms commented on May 11, 2024

@ivangretsky

solution

remame .exe & cd to the right path

image

but the * is not work, why?

from mkcert.

adamdecaf avatar adamdecaf commented on May 11, 2024

Was this problem solved?

from mkcert.

ivangretsky avatar ivangretsky commented on May 11, 2024

Nope

from mkcert.

adamdecaf avatar adamdecaf commented on May 11, 2024

What problem are you having? It looks like someone posted a nodejs server. Is your problem related to the certificate in Window's store or your application?

from mkcert.

ivangretsky avatar ivangretsky commented on May 11, 2024

I tried my best to describe my issue in the original post. Do I need to add something?

from mkcert.

adamdecaf avatar adamdecaf commented on May 11, 2024

Does the dev server report errors about the certificate files? Can you share the logs and code for the server?

from mkcert.

aweber1 avatar aweber1 commented on May 11, 2024

@ivangretsky you mentioned:

  1. Launched a local dev server with the test.xyz configured to be served both on http and https.

It's unclear what type of server you're trying to use the certificate with. That will have an impact on both how you generate and how the certificate is used.

That said, if you're using IIS, check out this blog post (shameless plug):
https://medium.com/@aweber01/locally-trusted-development-certificates-with-mkcert-and-iis-e09410d92031

from mkcert.

Tonzitos avatar Tonzitos commented on May 11, 2024

image

I am not sure if my problem is related

from mkcert.

mohamedmmc avatar mohamedmmc commented on May 11, 2024

image

I am not sure if my problem is related

i'm dealing with the same issue

from mkcert.

Marchiuzzz avatar Marchiuzzz commented on May 11, 2024

Having the exactly same issue

from mkcert.

DaggieBlanqx avatar DaggieBlanqx commented on May 11, 2024

image

OK

https & express sever

const https = require('https');
const express = require('express');
const fs = require('fs');

// const fs = require('fs');

// OpenSSL
// const privateKey = fs.readFileSync('./https-ssl/server.key');
// const certificate = fs.readFileSync('./https-ssl/server.crt');

// pem
const privateKey = fs.readFileSync('./ssl/webgeeker.xyz+3-key.pem');
const certificate = fs.readFileSync('./ssl/webgeeker.xyz+3.pem');

const credentials = {
    key: privateKey,
    cert: certificate,
};

const app = express();
// const app = express.createServer(credentials);
// https://localhost:8888

https.createServer(credentials, app).listen(8888);

app.get('/', function (req, res) {
    console.log('req =', req);
    res.header('Content-type', 'text/html');
    return res.end('<h1>Hello, HTTPS!</h1>');
});

Works absolutely great for me!

from mkcert.

Related Issues (20)

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.