nginx: https
Posted UniCofTea
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx: https相关的知识,希望对你有一定的参考价值。
1、编译
./configure --prefix=/usr/local/nginx-1.8
--with-http_stub_status_module (统计数据查看)
--with-pcre=/opt/install/nginx/pcre-8.44 (正则)
--with-http_sub_module
--add-module=/opt/install/nginx/nginx-delay-module-master (delay)
--with-http_ssl_module (for https)
2、配置
http {
log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘
‘$status $body_bytes_sent "$http_referer" ‘
‘"$http_user_agent" "$http_x_forwarded_for" "$https"‘;
server {
listen 443 ssl;
server_name www.test.com;
log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘
‘$status $body_bytes_sent "$http_referer" ‘
‘"$http_user_agent" "$http_x_forwarded_for" "$https"‘;
server {
listen 443 ssl;
server_name www.test.com;
ssl_certificate /home/judy/ssl/test.com.pem;
ssl_certificate_key /home/judy/ssl/test.com.key;
#ssl_session_cache shared:SSL:1m;
#ssl_session_timeout 5m;
#ssl_ciphers HIGH:!aNULL:!MD5;
#ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
说明:
内置变量$https:如果开启了SSL安全模式,值为“on”,否则为空字符串。
以上是关于nginx: https的主要内容,如果未能解决你的问题,请参考以下文章
expressjs设置tls连接https nginx服务器请求