Amaze UI Logo

码动指尖



letsencrypt安装免费的https证书

nginx域名证书生成

如果没有安装letsencrypt

则执行

git clone https://github.com/letsencrypt/letsencrypt


cd letsencrypt


./certbot-auto --help all


否则

进入/home/www/的letsencrypt目录

执行

./certbot-auto certonly --standalone --email 1023767856@qq.com -d 域名 -d 域名(可以多域名,每个域名前加-d即可)


https 的 nginx 配置


  server {

         listen 443;

         server_name 域名;

         ssl on;

         ssl_certificate 证书目录/fullchain.pem;

         ssl_certificate_key 证书目录/privkey.pem;

         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;

         set $root 项目根目录;

         root $root;

         index index.php index.html index.htm;


        if (!-e $request_filename) {

           rewrite ^(.*)$ /index.php?s=$1 last;

           break;

        }


        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {

                expires      30d;

        }


        location ~ .*\.(js|css)?$ {

                expires      12h;

        }

        location / {

            root   $root;

            index  index.html index.htm index.php;

            if (!-e $request_filename) {

              rewrite ^(.*)$ /index.php?s=$1 last;

              break;

            }

        }

        location ~ .+\.php($|/) {

            set $script $uri;

            set $path_info "";

            if ($uri ~ "^(.+\.php)(/.+)") {

               set $script $1;

               set $path_info $2;

            }

            root           $root;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php?IF_REWRITE=1;

            fastcgi_param    PATH_INFO    $path_info;

            fastcgi_param  SCRIPT_FILENAME  $root$fastcgi_script_name;

            client_max_body_size 500m;

            include        fastcgi_params;

        }


    }


 nginx

作者  :  奕弈

喵喵喵,你在心上



评论


About ME

about me

奕弈

为了最初的心,努力奋斗,从不懈怠的学习。

我不想成为一个庸俗的人。十年百年后,当我们死去,质疑我们的人同样死去,后人看到的是裹足不前、原地打转的你,还是一直奔跑、走到远方的我?

Contact ME