[GH-ISSUE #145] Help me !How Can I install in nginx on Win #87

Closed
opened 2026-02-25 22:32:33 +03:00 by kerem · 5 comments
Owner

Originally created by @chaihongjun on GitHub (Mar 1, 2019).
Original GitHub issue: https://github.com/FiloSottile/mkcert/issues/145

OS:WIN7

$  mkcert -install
Using the local CA at "C:\Users\chj\AppData\Local\mkcert" ✨
The local CA is now installed in the system trust store! ⚡️
Note: Firefox support is not available on your platform. ℹ️

$  mkcert www.demo.com
Using the local CA at "C:\Users\chj\AppData\Local\mkcert" ✨

Created a new certificate valid for the following names 📜
 - "www.demo.com"

The certificate is at "./www.demo.com.pem" and the key at "./www.demo.com-key.pem" ✅

here is my nginx vhost conf:

server {
        listen       443 ssl http2;
        server_name  www.demo.com  ;
        location / {
            root   D:/wwwroot/www.demo.com;
            index  index.html  index.php default.php;
           # include        D:/wwwroot/www.demo.com/up-*.conf;
        }
        autoindex off;
        include advanced_settings.conf;
            ssl on;
            ssl_certificate   www.demo.com.pem;
            ssl_certificate_key www.demo.com.pem-key.pem;
        #include expires.conf;
        location ~* .*\/(attachment|attachments|uploadfiles|avatar)\/.*\.(php|PHP7|phps|asp|aspx|jsp)$ {
        deny all;
        }
        location ~ ^.+\.php {
            root           D:/wwwroot/www.demo.com;
            fastcgi_pass   bakend;
            fastcgi_index  index.php;
            fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
            fastcgi_param  PATH_INFO $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED $document_root$fastcgi_path_info;
            include        fastcgi.conf;
        }
    }

And I'm sure the certificate files path is correct
here is my hosts:

127.0.0.1	www.demo.com

But, it cant run

Originally created by @chaihongjun on GitHub (Mar 1, 2019). Original GitHub issue: https://github.com/FiloSottile/mkcert/issues/145 OS:WIN7 ``` $ mkcert -install Using the local CA at "C:\Users\chj\AppData\Local\mkcert" ✨ The local CA is now installed in the system trust store! ⚡️ Note: Firefox support is not available on your platform. ℹ️ $ mkcert www.demo.com Using the local CA at "C:\Users\chj\AppData\Local\mkcert" ✨ Created a new certificate valid for the following names 📜 - "www.demo.com" The certificate is at "./www.demo.com.pem" and the key at "./www.demo.com-key.pem" ✅ ``` here is my nginx vhost conf: ``` server { listen 443 ssl http2; server_name www.demo.com ; location / { root D:/wwwroot/www.demo.com; index index.html index.php default.php; # include D:/wwwroot/www.demo.com/up-*.conf; } autoindex off; include advanced_settings.conf; ssl on; ssl_certificate www.demo.com.pem; ssl_certificate_key www.demo.com.pem-key.pem; #include expires.conf; location ~* .*\/(attachment|attachments|uploadfiles|avatar)\/.*\.(php|PHP7|phps|asp|aspx|jsp)$ { deny all; } location ~ ^.+\.php { root D:/wwwroot/www.demo.com; fastcgi_pass bakend; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi.conf; } } ``` And I'm sure the certificate files path is correct here is my hosts: ``` 127.0.0.1 www.demo.com ``` But, it cant run
kerem closed this issue 2026-02-25 22:32:33 +03:00
Author
Owner

@adamdecaf commented on GitHub (Mar 1, 2019):

ssl_certificate and ssl_certificate_key are filepaths. Did you run mkcert in the nginx config directory? Do you get an error when starting nginx?

<!-- gh-comment-id:468763618 --> @adamdecaf commented on GitHub (Mar 1, 2019): `ssl_certificate` and `ssl_certificate_key` are filepaths. Did you run `mkcert` in the nginx config directory? Do you get an error when starting nginx?
Author
Owner

@chaihongjun commented on GitHub (Mar 2, 2019):

ssl_certificate and ssl_certificate_key are filepaths. Did you run mkcert in the nginx config directory? Do you get an error when starting nginx?

I'm sure the certificate files path is correct, because these two files were in the same folder of the vhost conf。they are in the same directory
@adamdecaf

<!-- gh-comment-id:468856863 --> @chaihongjun commented on GitHub (Mar 2, 2019): > `ssl_certificate` and `ssl_certificate_key` are filepaths. Did you run `mkcert` in the nginx config directory? Do you get an error when starting nginx? I'm sure the certificate files path is correct, because these two files were in the same folder of the vhost conf。they are in the same directory @adamdecaf
Author
Owner

@chaihongjun commented on GitHub (Mar 2, 2019):

qq 20190302081649
@adamdecaf

<!-- gh-comment-id:468857393 --> @chaihongjun commented on GitHub (Mar 2, 2019): ![qq 20190302081649](https://user-images.githubusercontent.com/12774598/53673633-b4231c80-3cc3-11e9-85f4-310762f8cfe0.jpg) @adamdecaf
Author
Owner

@adamdecaf commented on GitHub (Mar 4, 2019):

Is there an error when you start nginx?

<!-- gh-comment-id:469086099 --> @adamdecaf commented on GitHub (Mar 4, 2019): Is there an error when you start nginx?
Author
Owner

@chaihongjun commented on GitHub (Mar 4, 2019):

@adamdecaf
Oh,it's my carelessness.
I have success
my local host were made mistake IP address and the ssl_certificate_key file name
Thank U very much!!!

<!-- gh-comment-id:469104444 --> @chaihongjun commented on GitHub (Mar 4, 2019): @adamdecaf Oh,it's my carelessness. I have success my local host were made mistake IP address and the `ssl_certificate_key` file name Thank U very much!!!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mkcert#87
No description provided.