- 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. MySQL简单的确定瓶颈

    如果接到报警可能需要ssh看看瓶颈是什么,怎么下手 确定os层 确定磁盘是否够用的:df –h 再看看系统整体状态: top 哪些进程占用资源比较多,能杀就杀 系统的负载 vmstat看看wa值,r列 ...

  2. mysql查询某个数据库某个表的字段

    1.查看字段详细信息 -- 查看详细信息 SELECT COLUMN_NAME "字段名称", COLUMN_TYPE "字段类型长度", IF(EXTRA=& ...

  3. Struts 2中访问Servlet API的几种方法小结

    1.使用ActionContext Action运行期间所用到的数据都保存在ActionContext中,例如session.客户端提交的参数等,ActionContext是Action的一个上下文对 ...

  4. 用vue.js实现购物车功能

    购物车是电商必备的功能,可以让用户一次性购买多个商品,常见的购物车实现方式有如下几种: 1. 用户更新购物车里的商品后,页面自动刷新. 2. 使用局部刷新功能,服务器端返回整个购物车的页面html 3 ...

  5. Java之构造方法及this、super关键字

    有关构造方法的理解: 需要对对象的数据进行初始化,则创建一个构造方法,此方法名字和类名一样,但是没有返回值(类型和具体的值都没,但是可以写return;).构造方法是用来创建对象的,所以是不能被对象调 ...

  6. T4310 祖玛游戏

    题目描述 祖玛是一款曾经风靡全球的游戏,其玩法是:在一条轨道上初始排列着若干 个彩色珠子,其中任意三个相邻的珠子不会完全同色.此后,你可以发射珠子到 轨道上并加入原有序列中.一旦有三个或更多同色的珠子 ...

  7. Sencha Touch和jQuery Mobile的比较

    第一组-行销和平台支持 Sencha Touch和jQuery Mobile都以HTML5框架著称.jQuery Mobile谦虚的说自己只是内建于所有流行的移动设备平台,而Sencha Touch则 ...

  8. 【读书笔记】构建之法(CH4~CH6)

    从chapter4至chapter6,围绕着构建过程的合作讨论构建之法,而合作与个人工作的区别却以一个微妙的问题为开端:阅读别人的代码有多难? 两人合作:(驾驶员与领航员) 合作要注意代码风格规范与设 ...

  9. 用YII实现多重查询(基于tag)

    场景: 有一个饭店表 restaurant,存放所有饭店记录.我需要一个功能,将饭店按照不同的条件进行多重查询.就象这样:   氛围:浪漫 / 商务会谈 / 茅草屋 菜系:川菜 / 鲁菜 / 家常菜. ...

  10. UVALive 4080 Warfare And Logistics (最短路树)

    很多的边会被删掉,需要排除一些干扰进行优化. 和UVA - 1279 Asteroid Rangers类似,本题最关键的地方在于,对于一个单源的最短路径来说,如果最短路树上的边没有改变的话,那么最短路 ...