wget https://raw.githubusercontent.com/xdtianyu/scripts/master/lets-encrypt/letsencrypt.sh
chmod +x letsencrypt.sh
Edit the following configuration file:
Vim letsencrypt.conf
account_key= "Letsencrypt-account.key" domain_key= "domain name. KEY" domain_dir= "Web site Folder" domains= "DNS: Domain name, DNS: domain name" #ECC =true# Lighttpd=true
Run:
./letsencrypt.sh letsencrypt.conf
Many files are generated after running
which
WWW.CHAINED.CRT domain name. Key
These two are for you.
Nginx Configuration:
User www;worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log inf o; #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 domain name;
#实现自动重写 rewrite ^ (. *) $ https://$host $ permanent; # HTTPS Server server {listen 443 SSL; server_name domain name; #charset: Utf-8; SSL_CERTIFICATE/HOME/WWWROOT/WWW.CHAINED.CRT; ssl_certificate_key/home/wwwroot/domain name. Key; Ssl_protocols TLSv1 TLSv1.1 TLSv1.2; Location/{root Web folder; Index index.html index.htm index.php; } location ~ \.php$ {fastcgi_buffer_size 128k; Fastcgi_buffers 32k; root Web Folder; Fastcgi_pass Unix:/tmp/php-fpm.sock; Fastcgi_index index.php; #include fastcgi.conf; Fastcgi_param Document_root website folder; Fastcgi_param script_filename website folder $fastcgi_script_name; Include Fastcgi_params; } error_page 502 503 504/50x.html; Location =/50x.html {root html; } }}
Linux security certificate request and configuration to Nginx