#user nobody;
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;

# server {
# listen 80;
# server_name www.omosat.com;

#charset koi8-r;

#access_log logs/host.access.log main;

# location / {
# root /website;
# 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
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}
server {
listen 443 ssl;
server_name baidu.com; # 你的域名

# root /website; # 前台文件存放文件夹,可改成别的
# index index.html index.htm; #// 上面配置的文件夹里面的index.html
ssl_certificate 1_baidu.com_bundle.crt; #// 改成你的证书的名字
ssl_certificate_key 2_baidu.com.key; #// 你的证书的名字
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
root /website;
index index.html index.html;
}
}
server {
listen 80;
server_name baidu.com; #// 你的域名
rewrite ^(.*)$ https://$host$1 permanent; #// 把http的域名请求转成https

}

}

nginx 添加https 配置的更多相关文章

  1. (转)Nginx的https配置记录以及http强制跳转到https的方法梳理

    Nginx的https配置记录以及http强制跳转到https的方法梳理 原文:http://www.cnblogs.com/kevingrace/p/6187072.html 一.Nginx安装(略 ...

  2. 已安装nginx支持https配置 the "ssl" parameter requires ngx_http_ssl_module

    原文链接:https://blog.seosiwei.com/detail/28 nginx已安装,ssl模块未安装的解决方法: 如果需要在linux中编译自己的nginx服务器,请参照:https: ...

  3. nginx tomcat https配置方案

    nginx目录下配置: ssl目录下 添加 证书和密码,如图 /etc/nginx/conf.d  下修改配置文件 HTTP域名的配置: ## Basic reverse proxy server # ...

  4. windows下搭建nginx服务器及实现nginx支持https配置流程

    最近刚接触到了tomcat结合nginx做网站的负载均衡.之前对tomcat搭配nginx实现负载均衡也写过,在上一篇的博客中,最近遇到的问题是要在http的基础上支持https.也就是支持加密的请求 ...

  5. Nginx之https配置

    14.1. 对称加密 安全隐患:钥匙除我之外,还有多个人拥有.泄露风险较大,钥匙传递的过程风险较大 14.2. 非对称加密 优缺点:私钥很安全.但是非对称算法开销很大,大批量应用于业务,会导致性能成本 ...

  6. Nginx之https配置 - 运维笔记 (http->https强转)

    一.Nginx安装(略)安装的时候需要注意加上 --with-http_ssl_module,因为http_ssl_module不属于Nginx的基本模块.Nginx安装方法: # ./configu ...

  7. nginx的https配置

    测试自签名的ssl证书 首先执行如下命令生成一个key openssl genrsa -des3 - 然后他会要求你输入这个key文件的密码.不推荐输入.因为以后要给nginx使用.每次reload ...

  8. Nginx的https配置记录以及http强制跳转到https的方法梳理

    一.Nginx安装(略)安装的时候需要注意加上 --with-http_ssl_module,因为http_ssl_module不属于Nginx的基本模块.Nginx安装方法: 1 2 # ./con ...

  9. Nginx SSL/HTTPS 配置

    使用OpenSSL生成证书 1.生成RSA密钥的方法 openssl genrsa -des3 -out privkey.pem 2048 这个命令会生成一个2048位的密钥,同时有一个des3方法加 ...

随机推荐

  1. CentOS安装git及使用Gitolite来管理版本库

    首先吐槽一下网上的各种教程,大部分都扯蛋,估计都是些所谓的"编辑"在网上瞎抄来的-- 以下内容都是基于CentOS的服务器端,Mac OS X的客户端. 如果是使用的Windows ...

  2. Libre 6008 「网络流 24 题」餐巾计划 (网络流,最小费用最大流)

    Libre 6008 「网络流 24 题」餐巾计划 (网络流,最小费用最大流) Description 一个餐厅在相继的N天里,第i天需要Ri块餐巾(i=l,2,-,N).餐厅可以从三种途径获得餐巾. ...

  3. CF1027E Inverse Coloring

    题意:n × n的矩阵,每个位置可以被染成黑/白色. 一种gay的染色是任意相邻两行的元素,每两个要么都相同,要么都不同.列同理. 一种gaygay的染色是一种gay的染色,其中没有哪个颜色的子矩阵大 ...

  4. SSM框架的搭建与测试

    关于框架的搭建无非就是 框架所依赖的jar包,然后就是关于各个框架的配置文件: 下面我们来看下不同层的依赖的jar包以及各个配置文件: 首先pojo这一层只需要依赖parent聚合工程 mapper层 ...

  5. maven构建SSM项目

    对于小型项目来说,使用默认的maven配置项目即可,可是现在分布式项目越来越多,如果巧妙的使用maven部署项目这成了关键. maven的pom.jar.war: 要正确部署得对maven的pom.w ...

  6. CentOS7安装新版git

    #安装Git yum install -y epel-release rpm -ivh https://centos7.iuscommunity.org/ius-release.rpm yum lis ...

  7. Nested Loops(嵌套循环)

    先扫描驱动表的(外表),外表的每一行驱动内表,然后匹配,所以nest loops不是主要依赖于内表有多少行,而是非常依赖于驱动表到底有多少行参与nested loops,因为驱动表(或者准确的说是驱动 ...

  8. 10个造型奇特的css3进度条(有的html被编辑器转义了,上面的代码还是OK的)。。。转载

    <div id="caseVerte"> <div id="case1"></div> <div id="c ...

  9. Javascript中的垃圾回收机制

    Javascript 中的内存管理 译自MDN,Memory Management 简介 在底层语言中,比如C,有专门的内存管理机制,比如malloc() 和 free().而Javascript是有 ...

  10. python中的__enter__ __exit__

    我们前面文章介绍了迭代器和可迭代对象,这次介绍python的上下文管理.在python中实现了__enter__和__exit__方法,即支持上下文管理器协议.上下文管理器就是支持上下文管理器协议的对 ...