Nginx配置SSL证书实现HTTPS访问

申请第三方权威认证机构(如CA,Symantec,GeoTrust,CFCA)签发的SSL数字证书,实现网站HTTPS访问

证书文件:

1
2
3
4
app.yezhou.cc.jks
app.yezhou.cc.key
app.yezhou.cc.pem
app.yezhou.cc.pfx

虚拟主机配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
server {
listen 80;
listen 443 ssl;
server_name app.yezhou.cc;
index index.html index.htm index.php;
root /data/www/app;
server_name_in_redirect off;

location ~ .+\.php($|/)
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;

fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
#伪静态及日志
#include /data/server/nginx/conf/rewrite/app.conf;
error_log /data/www/logs/app-error.log;
access_log /data/www/logs/app-access.log;

ssl on;
ssl_certificate /data/ssl/app/app.yezhou.cc.pem;
ssl_certificate_key /data/ssl/app/app.yezhou.cc.key;
ssl_session_timeout 5m;
}

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :