首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mkcert证书在本地ip地址上无效

mkcert证书在本地ip地址上无效
EN

Stack Overflow用户
提问于 2021-07-21 23:22:41
回答 1查看 584关注 0票数 0

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

证书似乎无效,我不知道我遗漏了什么。

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

代码语言:javascript
复制
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

网站-可用/hiker.conf

代码语言:javascript
复制
<VirtualHost *:80>
    # The ServerName directive sets the request scheme, 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
代码语言:javascript
复制
apachectl configtest
Syntax OK
代码语言:javascript
复制
service apache2 restart

EN

回答 1

Stack Overflow用户

发布于 2021-07-22 15:38:44

多亏了@SteffenUllrich,我找到了解决方案。

我要将CA导入到Windows10中,请按照这里描述的步骤"make-computer-trust-certificate-authority

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68472234

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档