nginx增加ssl服务方法
2015-07-14 14:36
543 查看
1.将申请到的ssl加密证书文件拷贝到nginx的conf目录下
如:server.pem、server.key
2.vim nginx.conf
例子:
3.配置http重定向到https
4.重启nginx 搞定
如:server.pem、server.key
2.vim nginx.conf
例子:
server { listen 443 ssl; #listen 80; server_name www.test.com; ssl_certificate server.pem; ssl_certificate_key server.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 10m; ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers RC4:HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; root /mnt/html/test; index index.php index.html index.htm; access_log logs/test.com_access.log; error_log logs/test.com_error.log debug; error_page 500 502 503 504 /50x.html; location = /50x.html { root /mnt/html; } #重定向 location / { if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; } } location ~ \.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } }
3.配置http重定向到https
server { listen 80; server_name www.test.com test.com; rewrite ^(.*)$ https://www.test.com$1 permanent; }
4.重启nginx 搞定
相关文章推荐
- nginx 安装手记
- nginx 安装手记 分类: Nginx 服务器搭建 2015-07-14 14:28 15人阅读 评论(0) 收藏
- RedHat Enterprise Linux 6.4使用Centos 6 的yum源 分类: 服务器搭建 Nginx 2015-07-14 14:11 5人阅读 评论(0) 收藏
- nginx+webpy+uswgi+jwplayer组合搭建流媒体服务器
- Nginx Rewrite可以用到的全局变量
- Nginx配置文件详细说明
- python+django+nginx+uwsgi环境解决timeout 504
- 基于nginx和ffmpeg搭建HLS流媒体服务器
- 解析nginx负载均衡
- awk 处理 nginx 日志
- nginx配置文件
- nginx支持ssi使用../
- 菜鸟学习-C语言函数参数传递详解-结构体与数组 分类: C/C++ Nginx 2015-07-14 10:24 89人阅读 评论(0) 收藏
- nginx配置中rewrite中变量判断conditon
- web前段跨域nginx代理配置
- Nginx之五:Nginx服务器和php-fpm服务器的分离
- Nginx Upstream Keepalive配置
- UPUPW_NGINX_PHP5.3.29_1504.7z的问题 REQUEST 数字的时候,有时候会失效
- 通过配置worker_cpu_affinity参数提升nginx性能
- nginx-限制后端服务器连接数