VPS侦探论坛

 找回密码
 注册
查看: 370|回复: 6

安全证书不能自己更新

[复制链接]
发表于 2022-9-5 10:11:21 | 显示全部楼层 |阅读模式

upstream fastcgi_backend {
    server   unix:/tmp/php-cgi.sock;
}

server
    {
        listen 443 ssl http2;
        #listen [::]:443 ssl http2;
        server_name www.eyeglassespro.com eyeglassespro.com;
        set $MAGE_ROOT /home/wwwroot/www.eyeglassespro.com;

        ssl_certificate /usr/local/nginx/conf/ssl/www.eyeglassespro.com/fullchain.cer;
        ssl_certificate_key /usr/local/nginx/conf/ssl/www.eyeglassespro.com/www.eyeglassespro.com.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_prefer_server_ciphers on;
        ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
        ssl_session_cache builtin:1000 shared:SSL:10m;
        # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
        ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

        

        root $MAGE_ROOT/pub;

        index index.php;
        autoindex off;
        charset UTF-8;
        error_page 404 403 = /errors/404.php;
        #add_header "X-UA-Compatible" "IE=Edge";


        # Deny access to sensitive files
        location /.user.ini {
            deny all;
        }

        # PHP entry point for setup application
        location ~* ^/setup($|/) {
            root $MAGE_ROOT;
            location ~ ^/setup/index.php {
                fastcgi_pass   fastcgi_backend;

                fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
                fastcgi_param  PHP_VALUE "memory_limit=756M \n max_execution_time=600";
                fastcgi_read_timeout 600s;
                fastcgi_connect_timeout 600s;

                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
            }

            location ~ ^/setup/(?!pub/). {
                deny all;
            }

            location ~ ^/setup/pub/ {
                add_header X-Frame-Options "SAMEORIGIN";
            }
        }

        # PHP entry point for update application
        location ~* ^/update($|/) {
            root $MAGE_ROOT;

            location ~ ^/update/index.php {
                fastcgi_split_path_info ^(/update/index.php)(/.+)$;
                fastcgi_pass   fastcgi_backend;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_param  PATH_INFO        $fastcgi_path_info;
                include        fastcgi_params;
            }

            # Deny everything but index.php
            location ~ ^/update/(?!pub/). {
                deny all;
            }

            location ~ ^/update/pub/ {
                add_header X-Frame-Options "SAMEORIGIN";
            }
        }

        location / {
            try_files $uri $uri/ /index.php$is_args$args;
        }

        location /pub/ {
            location ~ ^/pub/media/(downloadable|customer|import|custom_options|theme_customization/.*\.xml) {
                deny all;
            }
            alias $MAGE_ROOT/pub/;
            add_header X-Frame-Options "SAMEORIGIN";
        }

        location /static/ {
            # Uncomment the following line in production mode
            # expires max;

            # Remove signature of the static files that is used to overcome the browser cache
            location ~ ^/static/version {
                rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
            }

            location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|html|json)$ {
                add_header Cache-Control "public";
                add_header X-Frame-Options "SAMEORIGIN";
                expires +1y;

                if (!-f $request_filename) {
                    rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
                }
            }
            location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
                add_header Cache-Control "no-store";
                add_header X-Frame-Options "SAMEORIGIN";
                expires    off;

                if (!-f $request_filename) {
                   rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
                }
            }
            if (!-f $request_filename) {
                rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
            }
            add_header X-Frame-Options "SAMEORIGIN";
        }

        location /media/ {
            try_files $uri $uri/ /get.php$is_args$args;

            location ~ ^/media/theme_customization/.*\.xml {
                deny all;
            }

            location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
                add_header Cache-Control "public";
                add_header X-Frame-Options "SAMEORIGIN";
                expires +1y;
                try_files $uri $uri/ /get.php$is_args$args;
            }
            location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
                add_header Cache-Control "no-store";
                add_header X-Frame-Options "SAMEORIGIN";
                expires    off;
                try_files $uri $uri/ /get.php$is_args$args;
            }
            add_header X-Frame-Options "SAMEORIGIN";
        }

        location /media/customer/ {
            deny all;
        }

        location /media/downloadable/ {
            deny all;
        }

        location /media/import/ {
            deny all;
        }

        location /media/custom_options/ {
            deny all;
        }

        location /errors/ {
            location ~* \.xml$ {
                deny all;
            }
        }

        # PHP entry point for main application
        location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
            try_files $uri =404;
            fastcgi_pass   fastcgi_backend;
            fastcgi_buffers 1024 4k;

            fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
            fastcgi_param  PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
            fastcgi_read_timeout 600s;
            fastcgi_connect_timeout 600s;

            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

        gzip on;
        gzip_disable "msie6";

        gzip_comp_level 6;
        gzip_min_length 1100;
        gzip_buffers 16 8k;
        gzip_proxied any;
        gzip_types
            text/plain
            text/css
            text/js
            text/xml
            text/javascript
            application/javascript
            application/x-javascript
            application/json
            application/xml
            application/xml+rss
            image/svg+xml;
        gzip_vary on;

        # Banned locations (only reached if the earlier PHP entry point regexes don't match)
        location ~* (\.php$|\.phtml$|\.htaccess$|\.git) {
            deny all;
        }


        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

        include enable-php.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log off;
    }

    server {
        listen 80;
        server_name www.eyeglassespro.com eyeglassespro.com;
        location ^~ /.well-known/acme-challenge/ {
            default_type "text/plain";
            root         /home/wwwroot/www.eyeglassespro.com;
        }

        location = /.well-known/acme-challenge/ {
             return 404;
        }

    rewrite ^(.*)$ https://${server_name}$1 permanent;
    }
美国VPS推荐: 遨游主机LinodeLOCVPS主机云VPS2EZ搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2022-9-6 08:37:28 | 显示全部楼层


yisou 发表于 2022-9-5 19:54
我直接将虚拟主机配置文件删除了, 再运行lnmp ssl add, 以前是可以的,现也不行了。出错:
[Mon Sep  5 16 ...

因为acme.sh升级了默认用zerossl了,需要增加一个邮箱的参数到配置文件里面
执行:
/usr/local/acme.sh/acme.sh --register-account -m 你邮箱
后再添加就可以了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2022-9-5 10:11:59 | 显示全部楼层

军哥, 请问哪有问题呀?
谢谢了。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云VPS2EZ搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2022-9-5 16:17:25 | 显示全部楼层



你这个规则写的有问题,你这样 /.well-known/acme-challenge/ 下面的http验证文件都访问不到,都直接301了
把 rewrite ^(.*)$ https://${server_name}$1 permanent;
改成
  1.         location / {
  2.             return 301 https://$host$request_uri;
  3.         }
复制代码
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2022-9-5 19:54:29 | 显示全部楼层

我直接将虚拟主机配置文件删除了, 再运行lnmp ssl add, 以前是可以的,现也不行了。出错:
[Mon Sep  5 16:30:57 CST 2022] Please check log file for more details: /usr/local/acme.sh/acme.sh.log
[Mon Sep  5 19:50:35 CST 2022] Running cmd: issue
[Mon Sep  5 19:50:35 CST 2022] _main_domain='www.gloryoptical.com'
[Mon Sep  5 19:50:35 CST 2022] _alt_domains='gloryoptical.com'
[Mon Sep  5 19:50:35 CST 2022] Using config home:/usr/local/acme.sh
[Mon Sep  5 19:50:35 CST 2022] default_acme_server
[Mon Sep  5 19:50:35 CST 2022] ACME_DIRECTORY='https://acme.zerossl.com/v2/DV90'
[Mon Sep  5 19:50:35 CST 2022] DOMAIN_PATH='/usr/local/nginx/conf/ssl/www.gloryoptical.com'
[Mon Sep  5 19:50:35 CST 2022] Using ACME_DIRECTORY: https://acme.zerossl.com/v2/DV90
[Mon Sep  5 19:50:35 CST 2022] _init api for server: https://acme.zerossl.com/v2/DV90
[Mon Sep  5 19:50:35 CST 2022] Retrying GET
[Mon Sep  5 19:50:35 CST 2022] GET
[Mon Sep  5 19:50:35 CST 2022] url='https://acme.zerossl.com/v2/DV90'
[Mon Sep  5 19:50:35 CST 2022] timeout=
[Mon Sep  5 19:50:35 CST 2022] displayError='1'
[Mon Sep  5 19:50:35 CST 2022] _CURL='curl --silent --dump-header /usr/local/acme.sh/http.header  -L  -g '
[Mon Sep  5 19:50:44 CST 2022] ret='0'
[Mon Sep  5 19:50:44 CST 2022] _hcode='0'
[Mon Sep  5 19:50:44 CST 2022] ACME_KEY_CHANGE='https://acme.zerossl.com/v2/DV90/keyChange'
[Mon Sep  5 19:50:44 CST 2022] ACME_NEW_AUTHZ
[Mon Sep  5 19:50:44 CST 2022] ACME_NEW_ORDER='https://acme.zerossl.com/v2/DV90/newOrder'
[Mon Sep  5 19:50:44 CST 2022] ACME_NEW_ACCOUNT='https://acme.zerossl.com/v2/DV90/newAccount'
[Mon Sep  5 19:50:44 CST 2022] ACME_REVOKE_CERT='https://acme.zerossl.com/v2/DV90/revokeCert'
[Mon Sep  5 19:50:44 CST 2022] ACME_AGREEMENT='https://secure.trust-provider.com/repository/docs/Legacy/20201020_Certificate_Subscriber_Agreement_v_2_4_click.pdf'
[Mon Sep  5 19:50:44 CST 2022] ACME_NEW_NONCE='https://acme.zerossl.com/v2/DV90/newNonce'
[Mon Sep  5 19:50:44 CST 2022] Using CA: https://acme.zerossl.com/v2/DV90
[Mon Sep  5 19:50:44 CST 2022] _on_before_issue
[Mon Sep  5 19:50:44 CST 2022] _chk_main_domain='www.gloryoptical.com'
[Mon Sep  5 19:50:44 CST 2022] _chk_alt_domains='gloryoptical.com'
[Mon Sep  5 19:50:44 CST 2022] Le_LocalAddress
[Mon Sep  5 19:50:44 CST 2022] d='www.gloryoptical.com'
[Mon Sep  5 19:50:44 CST 2022] Check for domain='www.gloryoptical.com'
[Mon Sep  5 19:50:44 CST 2022] _currentRoot='/home/wwwroot/www.gloryoptical.com'
[Mon Sep  5 19:50:44 CST 2022] d='gloryoptical.com'
[Mon Sep  5 19:50:44 CST 2022] Check for domain='gloryoptical.com'
[Mon Sep  5 19:50:44 CST 2022] _currentRoot='/home/wwwroot/www.gloryoptical.com'
[Mon Sep  5 19:50:44 CST 2022] d
[Mon Sep  5 19:50:44 CST 2022] config file is empty, can not read CA_KEY_HASH
[Mon Sep  5 19:50:44 CST 2022] Using config home:/usr/local/acme.sh
[Mon Sep  5 19:50:44 CST 2022] ACME_DIRECTORY='https://acme.zerossl.com/v2/DV90'
[Mon Sep  5 19:50:44 CST 2022] _init api for server: https://acme.zerossl.com/v2/DV90
[Mon Sep  5 19:50:44 CST 2022] RSA key
[Mon Sep  5 19:50:44 CST 2022] config file is empty, can not read CA_EAB_KEY_ID
[Mon Sep  5 19:50:44 CST 2022] config file is empty, can not read CA_EAB_HMAC_KEY
[Mon Sep  5 19:50:44 CST 2022] config file is empty, can not read CA_EMAIL
[Mon Sep  5 19:50:44 CST 2022] No EAB credentials found for ZeroSSL, let's get one
[Mon Sep  5 19:50:44 CST 2022] acme.sh is using ZeroSSL as default CA now.
[Mon Sep  5 19:50:44 CST 2022] Please update your account with an email address first.
[Mon Sep  5 19:50:44 CST 2022] acme.sh --register-account -m my@example.com
[Mon Sep  5 19:50:44 CST 2022] See: https://github.com/acmesh-official/acme.sh/wiki/ZeroSSL.com-CA
[Mon Sep  5 19:50:44 CST 2022] _on_issue_err
[Mon Sep  5 19:50:44 CST 2022] Please check log file for more details: /usr/local/acme.sh/acme.sh.log

美国VPS、VPN、域名代购:http://shop63846532.taobao.com/

 楼主| 发表于 2022-9-5 20:08:12 | 显示全部楼层

[Mon Sep  5 20:04:07 CST 2022] No EAB credentials found for ZeroSSL, let's get one
[Mon Sep  5 20:04:07 CST 2022] acme.sh is using ZeroSSL as default CA now.
[Mon Sep  5 20:04:07 CST 2022] Please update your account with an email address first.
[Mon Sep  5 20:04:07 CST 2022] acme.sh --register-account -m my@example.com
[Mon Sep  5 20:04:07 CST 2022] See: https://github.com/acmesh-official/acme.sh/wiki/ZeroSSL.com-CA
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2022-10-5 09:21 , Processed in 0.019828 second(s), 17 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表