程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了mkcert 证书不适用于本地 IP 地址大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决mkcert 证书不适用于本地 IP 地址?

开发过程中遇到mkcert 证书不适用于本地 IP 地址的问题如何解决?下面主要结合日常开发的经验,给出你关于mkcert 证书不适用于本地 IP 地址的解决方法建议,希望对你解决mkcert 证书不适用于本地 IP 地址有所启发或帮助;

我正在尝试将我的应用程序转换为 PWA,我需要在 raspBerrypi 4 上的本地主机上使用 https,并且可以在 LAN 上使用 192.168.0.2 访问

证书似乎无效,我不明白我遗漏了什么。

所有命令都以root用户身份执行,所有步骤均来自GitHub官方页面

==

sites-available/hiker.conf

@H_460_9@mkcert -install

mkcert 192.168.80.2
Using the local CA at "/root/.local/share/mkcert" ✨

Created a new certificate valID for the following names �
 - "192.168.0.2"

The certificate is at "./192.168.0.2.pem" and the key at "./192.168.0.2-key.pem" ✅

mv 192.168.0.2-key.pem /etc/apache2/ssl/192.168.0.2-key.pem
mv 192.168.0.2.pem /etc/apache2/ssl/192.168.0.2.pem

ls -l /etc/apache2/sites-enabled
lrwxrwxrwx 1 root root   29 Jul 21 16:34 hiker.conf -> ../sites-available/hiker.conf
<VirtualHost *:80>
    # The Servername directive sets the request scheR_238_11845@e,hostname and port that
    # the server uses to IDentify itself. This is used when creaTing
    # redirection URLs. In the context of virtual hosts,the Servername
    # specifIEs what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this filE) this
    # value is not decisive as it is used as a last resort host regardless.
    # However,you must set it for any further virtual host explicitly.
    Servername 192.168.0.2
    Serveradmin webmaster@localhost
    documentRoot /var/www

    Alias /hiker /var/www/hiker/public

    <Directory /var/www/hiker/public>
        AllowOverrIDe All
        Order Allow,Deny
        Allow from All
   </Directory>

    # Available loglevels: trace8,...,trace1,deBUG,info,notice,warn,# error,crit,alert,emerg.
    # it is also possible to configure the loglevel for particular
    # modules,e.g.
    #LogLevel info ssl:warn
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/,which are
    # enabled or Disabled at a global level,it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally Disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        Servername 192.168.0.2
        Serveradmin webmaster@localsite.test
 
        documentRoot /var/www
 
        Alias /hiker /var/www/hiker/public

        <Directory /var/www/hiker/public>
            AllowOverrIDe All
            Order Allow,Deny
            Allow from All
        </Directory>
 
        ErrorLog ${APACHE_LOG_DIR}/localsite-error.log
        CustomLog ${APACHE_LOG_DIR}/localsite-access.log combined
 
        SSLENGIne on 
        SSLCertificatefile  /etc/apache2/ssl/192.168.0.2.pem
        SSLCertificateKeyfile /etc/apache2/ssl/192.168.0.2-key.pem
    </VirtualHost>
</IfModule>

# vim: Syntax=apache ts=4 sw=4 sts=4 sr noet

apa@R_197_10943@tl configtest
Syntax OK

mkcert 证书不适用于本地 IP 地址

mkcert 证书不适用于本地 IP 地址

解决方法

感谢@SteffenUllrich,我找到了解决方案。

我要按照此处描述的步骤将 CA 导入 Windows 10“make-computer-trust-certificate-authority”

我现在可以进行测试以将我的应用程序转换为 PWA

大佬总结

以上是大佬教程为你收集整理的mkcert 证书不适用于本地 IP 地址全部内容,希望文章能够帮你解决mkcert 证书不适用于本地 IP 地址所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。