Nginx配置SSL加密访问
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx配置SSL加密访问相关的知识,希望对你有一定的参考价值。
1.申请证书,可到 https://www.sslforfree.com/ 申请免费证书,有效期3个月。
2.下载证书文件到服务器.
3.配置nginx的vhosts.conf文件,以www.abc.net为例。
server { listen 443 ssl; server_name www.abc.net alias ; ssl_certificate E:/UPUPW/cert/certificate.crt; ssl_certificate_key E:/UPUPW/cert/private.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { root E:/www/www.abc.net; index index.html index.htm default.html default.htm index.php default.php app.php u.php; include E:/www/www.abc.net/up-*.conf; if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; break; } } autoindex off; include advanced_settings.conf; #include expires.conf; location ~* .*\/(attachment|attachments|uploadfiles|avatar)\/.*\.(php|php5|phps|asp|aspx|jsp)$ { deny all; } location ~ ^.+\.php { root E:/www/www.abc.net; fastcgi_pass bakend; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi.conf; } }
以上是关于Nginx配置SSL加密访问的主要内容,如果未能解决你的问题,请参考以下文章