安装openssl
brew install openssl
brew install openssl-devel
安装key
cd /usr/local/etc/nginx/servers
进入ngnix服务
mkdir uc_ca
创建文件夹
cd uc_ca
进入到文件夹中
sh ~a123/ssl_add.sh
执行shell文件
文件中内容如下:
#!/bin/bash
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
注意:
server.key 密码可以随便设置,下面的正常填写就好,common name要填写域名地址:test-uc.qschou.com,一步一步完成。
ngin配置文件
server {
listen 80;
server_name test-uc.qschou.com;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
}
server {
listen 443 ssl;
server_name test-uc.qschou.com;
ssl_certificate /usr/local/etc/nginx/servers/uc_ca/server.crt; // 上面自己创建的目录
ssl_certificate_key /usr/local/etc/nginx/servers/uc_ca/server.key;
ssl_session_timeout 300m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root /Users/a123/code/vue-h5-uc/dist;
index index.html index.htm ;
}
location ~ ^/(css|img|js|fonts){
root /Users/a123/code/vue-h5-uc/dist/static;
}
}
网友评论