Linux下安全证书申请以及配置到Nginx
2017-07-23 04:37
176 查看
wget https://raw.githubusercontent.com/xdtianyu/scripts/master/lets-encrypt/letsencrypt.sh chmod +x letsencrypt.sh
编辑下配置文件:
vim letsencrypt.conf
运行:
./letsencrypt.sh letsencrypt.conf
运行后会生成很多文件
其中:
www.chained.crt 域名.key
这两个是要的
nginx配置:
编辑下配置文件:
vim letsencrypt.conf
ACCOUNT_KEY="letsencrypt-account.key" DOMAIN_KEY="域名.key" DOMAIN_DIR="网站文件夹" DOMAINS="DNS:域名,DNS:域名" #ECC=TRUE #LIGHTTPD=TRUE
运行:
./letsencrypt.sh letsencrypt.conf
运行后会生成很多文件
其中:
www.chained.crt 域名.key
这两个是要的
nginx配置:
user www; 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; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name 域名; #实现自动重写 rewrite ^(.*)$ https://$host$1 permanent; } # HTTPS server server { listen 443 ssl; server_name 域名; #charset: utf-8; ssl_certificate /home/wwwroot/www.chained.crt; ssl_certificate_key /home/wwwroot/域名.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; location / { root 网站文件夹; index index.html index.htm index.php; } location ~ \.php$ { fastcgi_buffer_size 128k; fastcgi_buffers 32 32k; root 网站文件夹; fastcgi_pass unix:/tmp/php-fpm.sock; fastcgi_index index.php; #include fastcgi.conf; fastcgi_param DOCUMENT_ROOT 网站文件夹; fastcgi_param SCRIPT_FILENAME 网站文件夹$fastcgi_script_name; include fastcgi_params; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
相关文章推荐
- ssl证书申请以及nginx证书的配置
- Nginx虚拟主机以及负载均衡配置
- Nginx的安装以及配置文件
- Centos7 nginx安装并负载均衡WCF/Web以及负载策略配置
- nginx配置limit_conn_zone来限制并发连接数以及下载带宽
- nginx证书制作以及配置https并设置访问http自动跳转https(反向代理转发jboss)
- 初探nginx架构以及配置
- 阿里云免费SSL证书申请与安装使用-附Nginx,Apache,IIS 6,IIS 8配置SSL教程
- windows下安装以及配置nginx
- Let ’ s Encrypt SSL证书创建以及Nginx配置
- nginx的反向代理搭建配置以及搭建过程中的一些思维发散
- 阿里云服务器配置开发环境第七章:Centos7.3安装nginx以及环境配置
- Let's Encrypt申请免费https证书并配置nginx
- CA自认证和双向认证证书生成方法以及Nginx配置
- 反向代理概念以及apache,nginx配置反向代理实现负载均衡方法
- Nginx反向代理以及负载均衡配置
- SSL 证书购买以及Nginx配置相关问题
- Nginx配置端口转发 映射 以及连接超时问题
- Nginx安装配置以及配置文件详细说明
- Windows下安装以及配置nginx