- 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. 《javascript设计模式》笔记之第四章:继承

    一:首先,一个简单的继承实例: 首先是创建一个父类Person: function Person(name) { this.name = name; } Person.prototype.getNam ...

  2. JavaScriptSerializer类序列化日期时需要注意的问题

    1.让我们来看看使用JavaScriptSerializer类序列化日期会出现什么问题? 1)创建用于序列化的测试类,如下: public class Person { public int ID { ...

  3. vs 2017注册码 激活码

    Visual Studio 2017(VS2017) 企业版 Enterprise 注册码:NJVYC-BMHX2-G77MM-4XJMR-6Q8QFVisual Studio 2017(VS2017 ...

  4. CF1025B Weakened Common Divisor

    思路: 首先选取任意一对数(a, b),分别将a,b进行因子分解得到两个因子集合然后取并集(无需计算所有可能的因子,只需得到不同的质因子即可),之后再暴力一一枚举该集合中的元素是否满足条件. 时间复杂 ...

  5. XML文件的解析和序列化

    序列化: private void createXml() { XmlSerializer serializer = Xml.newSerializer();// xml文件生成器 File file ...

  6. SQL 数学串函数

    数学函数 ceiling  取上限 floor  取下限 round 四舍五入 len   长度 abs  绝对值 PI()圆周率 sqrt 开根号 qwuare 平方根 select  10     ...

  7. 在SAP CRM WebClient UI中用javascript触发ABAP event

    环境:SAP CRM WebClient UI 需求:在WebClient UI里不通过用户手动点击,而是使用JavaScript代码自动触发ABAP后台的代码. 解决方案: 1. 定义一个hidde ...

  8. 搭建一个入门springboot工程

    springboot工程搭建(入门案例) 第一步:创建maven工程 第二步:设置项目信息 第三步:默认项目名称,不用改动(第二步已填写)  第三步:在pom.xml中导入依赖 SpringBoot要 ...

  9. GRANT - 定义访问权限

    SYNOPSIS GRANT { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER } [,...] | ALL [ ...

  10. roi_pooling层

    roi_pooling层先把rpn生成的roi映射到特征提取层最后一层,然后再分成7*7个bin进行池化 下面是roi_pooling层的映射到特征提取层的代码,可以看到用的是round函数,也就是说 ...