首页 > 解决方案 > 为虚拟主机 laravel 提供 SSL 证书

问题描述

我有一个项目,我想作为前端开发人员工作,而 laravel 中的后端
一切都很好,我会开始工作,但是当我访问网站上的任何页面时,链接(例如图像、css、js 等链接)是HTTPS,但是我机器中的链接是HTTP,所以我大部分有SSL来运行项目

我试过虚拟主机

<VirtualHost *:8000>
    DocumentRoot "C:/xampp/htdocs/bm/public"
    ServerName business.example.lc:8000
    ServerAdmin admin@example.com 

    #   SSL Engine Switch: Enable/Disable SSL for this virtual host.

    SSLEngine on    
    SSLCertificateFile    "C:/xampp/apache/conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "C:/xampp/apache/conf/ssl.key/server.key"
  
    <Directory "C:/xampp/htdocs/bm/public">
        #SSLOptions +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot "C:/xampp/htdocs/bm/public"
    ServerName business.example.lc:443
    ServerAdmin admin@example.com 

    #   SSL Engine Switch: Enable/Disable SSL for this virtual host.

    SSLEngine on    
    SSLCertificateFile    "C:/xampp/apache/conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "C:/xampp/apache/conf/ssl.key/server.key"
  
    <Directory "C:/xampp/htdocs/bm/public">
        #SSLOptions +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

主机文件

127.0.0.1:8000          business.example.lc

但是当我访问https://business.example.lc/它时它会看到我 404 仅适用于http://business.example.lc/

我也试过:

> C://xampp/htdocs/bm> makecert.bat

但是在这里当我提交时,它需要一个密码:

Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:

返回:

C:\xampp\apache>makecert.bat
Generating a RSA private key
..........+++++
....................................................................................................+++++
writing new private key to 'privkey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
Verify failure
7920:error:2807106B:UI routines:UI_process:processing error:crypto\ui\ui_lib.c:545:while reading strings
7920:error:0906406D:PEM routines:PEM_def_callback:problems getting password:crypto\pem\pem_lib.c:59:
7920:error:0907E06F:PEM routines:do_pk8pkey:read key:crypto\pem\pem_pk8.c:83:
unable to load Private Key
5656:error:0909006C:PEM routines:get_name:no start line:crypto\pem\pem_lib.c:745:Expecting: ANY PRIVATE KEY
Can't open server.csr for reading, No such file or directory
8304:error:02001002:system library:fopen:No such file or directory:crypto\bio\bss_file.c:69:fopen('server.csr','r')
8304:error:2006D080:BIO routines:BIO_new_file:no such file:crypto\bio\bss_file.c:76:
Could Not Find C:\xampp\apache\.rnd
Could Not Find C:\xampp\apache\server.csr
The system cannot find the file specified.
The system cannot find the file specified.

-----
Das Zertifikat wurde erstellt.
The certificate was provided.

Press any key to continue . . .

标签: laravelsslxamppvhosts

解决方案


推荐阅读