webman-https-ssl-证书配置问题-Nginx配置

wangsq

下面是我在用的webman配置https和开机自启动

↓↓↓没有设置反向代理↓↓↓

↓↓↓下面是配置文件↓↓↓

upstream webman {
    server 127.0.0.1:8787;
    keepalive 10240;
}

server {
    server_name www.abcd.com;
    listen 80;
    listen 443 ssl http2;
    access_log off;
    error_log off;
    proxy_buffering off;
    root /www/wwwroot/www.abcd.com/public;
    #强制重定向https
    if ($server_port !~ 443){
        rewrite ^(/.*)$ https://$host$1 permanent;
    }
   #ssl
    ssl_certificate /www/server/panel/vhost/cert/www.abcd.com/fullchain.pem;
    ssl_certificate_key /www/server/panel/vhost/cert/www.abcd.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
   #ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 1440m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497  https://$host$request_uri;
     #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }
     #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
     #禁止在证书验证目录放入敏感文件
    if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
        return 403;
    }
     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log /dev/null;
        access_log /dev/null;
    }

    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log /dev/null;
        access_log /dev/null;
    }
    location ^~ / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        if (!-f $request_filename){
            proxy_pass http://webman;
        }
    }
}

另外我没有用守护进程,好像我这边系统的问题,我用的下面的方法也是可以开机自动启动的

1290 2 2
2个评论

wangsq
upstream webman {
    server 127.0.0.1:8787;
    keepalive 10240;
}

server {
    server_name www.abc.com;
    listen 80;
    listen 443 ssl http2;
    access_log off;
    error_log off;
    proxy_buffering off;
    root /www/wwwroot/www.abc.com/public;
    #CERT-APPLY-CHECK--START
    # 用于SSL证书申请时的文件验证相关配置 -- 请勿删除
    include /www/server/panel/vhost/nginx/well-known/www.abc.com.conf;
    #CERT-APPLY-CHECK--END

    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    #HTTP_TO_HTTPS_START
    if ($server_port !~ 443){
        rewrite ^(/.*)$ https://$host$1 permanent;
    }
    #HTTP_TO_HTTPS_END

    #ssl
    ssl_certificate /www/server/panel/vhost/cert/www.abc.com/fullchain.pem;
    ssl_certificate_key /www/server/panel/vhost/cert/www.abc.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
   #ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 1440m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497  https://$host$request_uri;
    #强制重定向https
   #ssl   #ssl_ciphers HIGH:!aNULL:!MD5;
     #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }
     #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
     #禁止在证书验证目录放入敏感文件
    if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
        return 403;
    }
     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log /dev/null;
        access_log /dev/null;
    }

    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log /dev/null;
        access_log /dev/null;
    }
    location ^~ / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        if (!-f $request_filename){
            proxy_pass http://webman;
        }
    }
}
  • 暂无评论
李奋斗先生

这么配置貌似不好使啊

  • 暂无评论

wangsq

430
积分
0
获赞数
0
粉丝数
2023-03-18 加入
×
🔝