
最近在玩rasa对话机器人,初步搭了一个模型,但是如果整个交互要在rasa shell命令行里打字的话,估计许多人看一眼就不想玩了。
所以,想着为RASA搞一个web UI,但是由于 CORS的限制,要求网站必须支持https。
于是,又要折腾了,:D
1. 申请阿里的免费SSL证书
先登录到阿里云的控制台,然后在右上角的搜索里搜索SSL证书。

找到后,照着其指示的步骤,下一步,下一步,下一步,申请到一个为期一年的免费的SSL证书。
2. 安装证书到nginx
将申请到的免费证书下载下来,然后手动安装部署到网站上。
server {
listen 80;
root /www/web/www_open365_com_cn/public_html;
server_name www.open365.com.cn www.open365.com.cn;
index index.html index.php index.htm;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 503 /errpage/503.html;
location ~ \.php(.*)$ {
fastcgi_pass unix:/tmp/php-73-cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name;
fastcgi_param PATH_INFO $2;
include fcgi.conf;
}
location ~ /\.ht {
deny all;
}
location / {
try_files $uri $uri/ /?$args;
}
}
server {
listen 443;
root /www/web/www_open365_com_cn/public_html;
ssl on;
ssl_certificate cert/www.open365.com.cn.pem;
ssl_certificate_key cert/www.open365.com.cn.key;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
server_name www.open365.com.cn www.open365.com.cn;
index index.html index.php index.htm;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 503 /errpage/503.html;
location ~ \.php(.*)$ {
fastcgi_pass unix:/tmp/php-73-cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name;
fastcgi_param PATH_INFO $2;
include fcgi.conf;
}
location ~ /\.ht {
deny all;
}
location / {
try_files $uri $uri/ /?$args;
}
}
2. 重启加载nginx生效
3. FAQ
nginx -s reload
1)TLSv1.3不支持
nginx: [warn] invalid value "TLSv1.3" in /www/wdlinux/nginx-1.8.1/conf/vhost/www.open365.com.cn.conf:12
再回去将第12行里的TLSv1.3去掉,再重新加载nginx,OK。
2)nginx不支持ssl
the "ssl" parameter requires ngx_http_ssl_module
收到the “ssl” parameter requires ngx_http_ssl_module报错:您需要重新编译Nginx并在编译安装的时候加上–with-http_ssl_module配置。
3)打开证书失败
"/cert/3970497_demo.aliyundoc.com.pem":BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory :fopen('/cert/3970497_demo.aliyundoc.com.pem','r') error :2006D080:BIO routines:BIO_new_file:no such file)
收到”/cert/3970497_demo.aliyundoc.com.pem”:BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(‘/cert/3970497_demo.aliyundoc.com.pem’,’r’) error:2006D080:BIO routines:BIO_new_file:no such file)报错:您需要去掉证书相对路径最前面的/。例如,您需要去掉/cert/cert-file-name.pem最前面的/,使用正确的相对路径cert/cert-file-name.pem。