Linux脚本申请证书

1、下载文件
wget https://raw.githubusercontent.com/xdtianyu/scripts/master/lets-encrypt/letsencrypt.sh
wget https://raw.githubusercontent.com/xdtianyu/scripts/master/lets-encrypt/letsencrypt.conf
2、授权
chmod +x letsencrypt.sh
3、下载插件
yum install python-argparse
4、运行
./letsencrypt.sh letsencrypt.conf

login.xiaomilaile.com/.well-known/acme-challenge9AVVF3uwWfpiq7CQtkpCG5SeMApVVPG3KNkBdaQ871A 



大神写的脚本:
http://www.111cn.net/sys/linux/103559.htm

就是有个域名验证的问题
他会生成一个文件 然后会去访问 需要访问到这个文件就算域名验证成功 你看那个网址上有说明的 




Linux脚本申请证书_第1张图片


就这样做就可以申请到let's encrypt证书,也不用通过网站申请


一般会以这么个结尾来访问生成的验证域名文件


参考Nginx配置

 server {
        listen 443 ssl;
        server_name heqf.com;

       # ssl_certificate     /data/nginx/conf/1_www.heqf.com_bundle.crt;
        #ssl_certificate_key /data/nginx/conf/2_www.heqf.com_bundle.key;
        ssl_certificate     /opt/letsencrypt/example.chained.crt;
        ssl_certificate_key /opt/letsencrypt/example.com.key; 
         location / {
            root  /data/nginx/html/heqfweb1_0;
            index login.html;
         }
	
        location /local-command {
              proxy_pass http://11.11.11.11:8011/command;
        }
	
        location /local-getUrl {
              proxy_pass http://11.11.11.11:8011/getUrl;
        }
	
	location /local-interface {
              proxy_pass http://11.11.11.11:8011/interface;
        }
	
	location ^~ /uap-html/ {
	      proxy_pass http://user.heqf.com/;
	}        
        location /uap-interface {
              proxy_pass http://user.heqf.com:8091/interface;
        }
	
	location /msg-a201 {
              proxy_pass http://heqf.com;
        }
	
	location /msg-a202 {
              proxy_pass http://heqf.com;
        }
	
	location /msg-a101 {
              proxy_pass http://11.11.11.11;
        }
	
	location /msg-a102 {
              proxy_pass http://11.11.11.11;
        }

	location ^~ /aliyun/ {
            proxy_pass http://heqf.img-cn-beijing.aliyuncs.com/;
        }
       
        location ^~ /file-view {
            proxy_pass http://11.11.11.11:3300/upload_url;
        }
        
	location ^~ /.well-known/acme-challenge/{
              proxy_pass http://heqf.com:9099/.well-known/acme-challenge/;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
       }
    }

server {
        listen       80;
        server_name  localhost;
				rewrite ^(.*)$  https://$host$1 permanent;
        #charset koi8-r;
         charset utf-8;
        #access_log  logs/host.access.log  main;

        location / {
            root  /data/nginx/html/heqf1_0;
           # index  index.html index.htm;
             index login.html;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

	location ^~ /.well-known/acme-challenge/{
              proxy_pass http://heqf.com:9099/.well-known/acme-challenge/;
        }
       
    }



你可能感兴趣的:(java,web,nginx,其他)