- ssl 证书申请

申请域名的网站申请下载对应文件即可

- nginx  配置 https

[root@VM_2_29_centos conf]# nginx -t
nginx: [emerg] unknown directive "ssl_certificate" in /usr/local/nginx/conf/nginx.conf:128
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
原因:安装 nginx 的时候未将 ssl 模块编译进 nginx 得重新编译安装
[root@VM_2_29_centos conf]# ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module
[root@VM_2_29_centos conf]# make && make install 
 
查看 nginx 安装的模块:

[root@VM_2_29_centos ~]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module

nginx.conf

[root@VM_2_29_centos ~]# cat /usr/local/nginx/conf/nginx.conf
 
#user nobody;
user root;
worker_processes 1;
 
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
 
#pid logs/nginx.pid;
 
 
events {
worker_connections 1024;
}
 
 
http {
include mime.types;
default_type application/octet-stream;
 
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
 
#access_log logs/access.log main;
 
sendfile on;
#tcp_nopush on;
 
#keepalive_timeout 0;
keepalive_timeout 65;
 
#gzip on;
 
# http server 80 
server {
listen 80;
server_name zhuoqun.info;
charset utf-8;
rewrite ^(.*) https://$host$1 permanent;  # 实现80端口进来的请求,重定向为https了
# ssl on;
# ssl_certificate /root/yzq/configs/1_zhuoqun.info_bundle.crt;
# ssl_certificate_key /root/yzq/configs/2_zhuoqun.info.key;
# ssl_session_timeout 5m;
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
# ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; #按照这个套件配置
# ssl_prefer_server_ciphers on;
 
 
#charset koi8-r;
 
#access_log logs/host.access.log main;
access_log /root/yzq/logs/host.access.log;
error_log /root/yzq/logs/host.error.log;
 
 
location /media {
alias /root/yzq/djangos/blog/media;
 
}
 
location /static {
alias /root/yzq/djangos/blog/static_root;
 
}
 
location / {
uwsgi_pass 127.0.0.1:9090;
include uwsgi_params;
#root html;
#index index.html index.htm;
}
 
#error_page 404 /404.html;
 
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
 
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
 
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
 
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
 
 
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
 
# location / {
# root html;
# index index.html index.htm;
# }
#}
 
 
# HTTPS server 443
#
server {
listen 443;
server_name zhuoqun.info;
charset utf-8;
 
ssl on;
ssl_certificate /root/yzq/configs/1_zhuoqun.info_bundle.crt;
ssl_certificate_key /root/yzq/configs/2_zhuoqun.info.key;
 
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
 
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
 
access_log /root/yzq/logs/host.access.log;
error_log /root/yzq/logs/host.error.log;
 
location / {
uwsgi_pass 127.0.0.1:9090;
include uwsgi_params;
# root html;
# index index.html index.htm;
}
 
location /media {
alias /root/yzq/djangos/blog/media;
}
 
location /static {
alias /root/yzq/djangos/blog/static_root;
}
 
}
 
}

nginx+django+uwsgi+https 配置问题点的更多相关文章

  1. Nginx+Django+Uwsgi+php

    在FreeBSD结合Nginx和FastCGI简单配置Django和PHP  http://blog.chinaunix.net/uid-11131943-id-3031767.html Nginx+ ...

  2. nginx+django+uwsgi

    最近来了兴致,想搞一下django开发,so,  搭建一下环境 1.安装django,可能通过pip install 或者源码安装(因为环境是python2.6.6的环境,所以这里采用django 1 ...

  3. 自动化运维web环境搭建:Nginx+Django+uwsgi

    参考资料: http://lovelace.blog.51cto.com/1028430/1600594 http://www.cnblogs.com/xiongpq/p/3381069.html 安 ...

  4. 使用django UWSGI 出现 Bad Request (400)

    使用 Nginx + Django+UWSGI 部署机器时,一直出现 Debugging Apache/Django/WSGI Bad Bad Request (400) 错误 最后发现问题是 Dja ...

  5. Django+uwsgi+Nginx安装部署

    安装 安装Nginx Nginx是最流行的高性能HTTP服务器. 安装pcre: wget https://sourceforge.net/projects/pcre/files/pcre/8.37/ ...

  6. Nginx+PostgreSQL+Django+UWSGI搭建

    最近因为项目上的需要开始大量使用nginx,因此也想趁机将以前常用的django+apache的架构换成django+nginx.常见的 django webapp 部署方式采用FCGI 或 WSGI ...

  7. Nginx+Python+uwsgi+Django的web开发环境安装及配置

    Nginx+Python+uwsgi+Django的web开发环境安装及配置 nginx安装 nginx的安装这里就略过了... python安装 通常系统已经自带了,这里也略过 uwsgi安装 官网 ...

  8. centos6.5安装nginx+python+uwsgi+django

    nginx+uwsgi+django环境部署及测试 默认系统自带的python2.6.6 第一步(安装setuptools) wget https://pypi.python.org/packages ...

  9. Django + Uwsgi + Nginx 实现生产环境部署

    本节内容 uwsgi 介绍 uwsgi安装使用 nginx安装配置 django with nginx 如何在生产上部署Django? Django的部署可以有很多方式,采用nginx+uwsgi的方 ...

随机推荐

  1. 为什么static方法中不可以调用非static方法

    Java是面向对象的语言,所有的变量,方法都是针对对象而言的.一般来说,要调用一个方法,你需要new 这个方法的对象. 什么时候用static? 如果你想要: 对于一个类的所有对象共享一个变量或者是方 ...

  2. python学习之列表元组,字典

    list:元素性质可以不一致,元素还可以是list,可类似数组方法进行索引(也可以用负数索引,-1表示最后一个),可用.append('')进行动态增加,可用pop()删除最后一个或者pop(i)删除 ...

  3. Linux--NiaoGe-Service-04

    操作系统版本:CentOS 6.10 x86_64 查看内核所获取到的网卡信息 [root@xueji ~]# dmesg | grep -in eth :e1000 ::-bit) :0c::6b: ...

  4. Unity加载AssetBundle的方法

    using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; usin ...

  5. windows 服务器开设端口

    主要用于服务器建设网站的时候开设端口 依次点击“开始”—“控制面板”—“windows防火墙” 2 先点击“打开或关闭windows防火墙”将windows防火墙打开 3 点击“高级设置” 4 设置入 ...

  6. react注意点

    event 对象 和普通浏览器一样,事件监听函数会被自动传入一个 event 对象,这个对象和普通的浏览器 event 对象所包含的方法和属性都基本一致.不同的是 React.js 中的 event  ...

  7. js图片预加载以及延迟加载

    当我们需要做图片轮播的时候,如果让图片提前下载到本地,用浏览器缓存起来,我们可以用Image对象: function preLoadImg(){ var img=new Image(); img.sr ...

  8. cvCanny的参数

    cvCanny 函数功能:采用Canny方法对图像进行边缘检测 函数原型: void cvCanny( const CvArr* image, CvArr* edges, double thresho ...

  9. Java多态的应用

    //多态的应用 class Animal{     public void eat(){     } } class Dog extends Animal{     public void eat() ...

  10. Xcode - 'openssl/opensslconf.h' file not found解决

    点击Build Settings搜索Header Search Paths,添加$(SRCROOT)/目录/Alipay