`

AppStore ATS自签名证书研究 - 证书生成及服务器配置

 
阅读更多

参考教材:

http://www.cnblogs.com/lihuang/articles/4205540.html

http://blog.csdn.net/wuwo333/article/details/53020403

 

 

1,生成私钥:得到.key文件

> openssl genrsa -des3 -out fanyc.cn.key 2048
  说明:生成rsa私钥,des3算法,2048位强度,server.key是秘钥文件名。

 

2,生成CSR(证书签名请求):得到.csr文件

> openssl req -new -key fanyc.cn.key -out fanyc.cn.csr
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:JiangSu
Locality Name (eg, city) [Default City]:NanJing
Organization Name (eg, company) [Default Company Ltd]:SskGroup
Organizational Unit Name (eg, section) []:Ssk
Common Name (eg, your name or your server's hostname) []:*.fanyc.cn
Email Address []:admin@ssk.cn

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

说明:需要依次输入国家,地区,城市,组织,组织单位,Common Name和Email。

其中Common Name,应该与域名保持一致,泛域名采用*.fanyc.cn。

 

3,删除私钥中的密码:每次重启Nginx都要输入密码,太麻烦,好像reload还没有必须restart

> cp fanyc.cn.key fanyc.cn.key.org
> openssl rsa -in fanyc.cn.key.org -out fanyc.cn.key

 

4,生成自签名证书:得到*.crt文件

> openssl x509 -sha256 -req -days 3650 -in fanyc.cn.csr 
  -signkey fanyc.cn.key -out fanyc.cn.crt

 说明:-sha256:使用sha256算法

           -days:证书有效期10年

 

5,生成windows使用的证书文件pfx

> openssl pkcs12 -export -out fanyc.cn.pfx -inkey fanyc.cn.key -in fanyc.cn.crt

 

6,Nginx服务器配置

server{
        listen  443 ssl;
        server_name www.fanyc.cn;

        ssl on;
        ssl_certificate /etc/nginx/ca/fanyc.cn.crt;
        ssl_certificate_key     /etc/nginx/ca/fanyc.cn.key;

        location /应用名 {
                proxy_pass http://内网地址:内网端口/应用名;
        }
}

 当前服务器Nginx版本

nginx version: nginx/1.10.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) 
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx 
--modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf 
--error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log 
--pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock 
--http-client-body-temp-path=/var/cache/nginx/client_temp 
--http-proxy-temp-path=/var/cache/nginx/proxy_temp 
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp 
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp 
--http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx 
--group=nginx --with-http_ssl_module --with-http_realip_module 
--with-http_addition_module --with-http_sub_module --with-http_dav_module 
--with-http_flv_module --with-http_mp4_module --with-http_gunzip_module 
--with-http_gzip_static_module --with-http_random_index_module 
--with-http_secure_link_module --with-http_stub_status_module 
--with-http_auth_request_module --with-http_xslt_module=dynamic 
--with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic 
--with-http_perl_module=dynamic --add-dynamic-module=njs-1c50334fbea6/nginx 
--with-threads --with-stream --with-stream_ssl_module --with-http_slice_module 
--with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module 
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 
-mtune=generic'

 

至此,服务器已完成配置,可以成功访问了。

 

苹果ATS检测:https://www.qcloud.com/product/ssl#userDefined10

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics