DeWeb配置SSL的方法,未亲测,供参考
DeWeb配置SSL的方法
1、购买域名的服务商申明免费的SSL证书,然后证书类型下载选择Nginx
2、下载Nginx,http://nginx.org/download/nginx-1.20.0.zip
3、配置nginx.conf,然后把cert.key和cert.pem放到相应的目录,可以参考下面的配置
4、启动nginx.exe
5、启动DeWebServer.exe,配置默认主页
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# HTTPS server
#
server {
listen 443;
server_name demo.delphibbs.com;
ssl on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_certificate cert.pem; #证书路径
ssl_certificate_key cert.key; #请求认证 key 的路径
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:80;
}
}
}