Joog 发表于 2025-1-11 14:01:17

伪静态与反向代理有冲突怎么解决?

为了能快速了解并处理您的问题,请提供以下基础信息:面板、插件版本:9.2.0
系统版本: Ubuntu 22
问题描述:如果先开启伪静态反向代理就出错.   如果先开启反向代理,伪静态就出错。求解决
相关截图(日志、错误):

Joog 发表于 2025-1-11 14:02:16

以下是配置文件

server
{
    listen 80;
    listen 443 ssl http2 ;
    server_name a.okfk.top b.okfk.top;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/yufu/public;
    #CERT-APPLY-CHECK--START
    # 用于SSL证书申请时的文件验证相关配置 -- 请勿删除
    include /www/server/panel/vhost/nginx/well-known/a.okfk.top.conf;
    #CERT-APPLY-CHECK--END

    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    ssl_certificate    /www/server/panel/vhost/cert/a.okfk.top/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/a.okfk.top/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    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 10m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497https://$host$request_uri;

    #SSL-END

    #ERROR-PAGE-START错误页配置,可以注释、删除或修改
    error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END

    #PHP-INFO-STARTPHP引用配置,可以注释或修改
    #清理缓存规则

    location ~ /purge(/.*) {
      proxy_cache_purge cache_one $host$1$is_args$args;
      #access_log/www/wwwlogs/a.okfk.top_purge_cache.log;
    }
        #引用反向代理规则,注释后配置的反向代理将无效
        include /www/server/panel/vhost/nginx/proxy/a.okfk.top/*.conf;

        include enable-php-00.conf;
    #PHP-INFO-END

    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/a.okfk.top.conf;
    #REWRITE-END

    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md)
    {
      return 404;
    }

    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
      allow all;
    }

    #禁止在证书验证目录放入敏感文件
    if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
      return 403;
    }

   

   
    access_log/www/wwwlogs/a.okfk.top.log;
    error_log/www/wwwlogs/a.okfk.top.error.log;
}

Joog 发表于 2025-1-11 14:03:19

nginx 配置文件

userwww www;
worker_processes auto;
error_log/www/wwwlogs/nginx_error.logcrit;
pid      /www/server/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;

stream {
    log_format tcp_format '$time_local|$remote_addr|$protocol|$status|$bytes_sent|$bytes_received|$session_time|$upstream_addr|$upstream_bytes_sent|$upstream_bytes_received|$upstream_connect_time';

    access_log /www/wwwlogs/tcp-access.log tcp_format;
    error_log /www/wwwlogs/tcp-error.log;
    include /www/server/panel/vhost/nginx/tcp/*.conf;
}

events
    {
      use epoll;
      worker_connections 51200;
      multi_accept on;
    }

http
    {
      include       mime.types;
                #include luawaf.conf;

                include proxy.conf;
      lua_package_path "/www/server/nginx/lib/lua/?.lua;;";

      default_typeapplication/octet-stream;

      server_names_hash_bucket_size 512;
      client_header_buffer_size 32k;
      large_client_header_buffers 4 32k;
      client_max_body_size 50m;

      sendfile   on;
      tcp_nopush on;

      keepalive_timeout 60;

      tcp_nodelay on;

      fastcgi_connect_timeout 300;
      fastcgi_send_timeout 300;
      fastcgi_read_timeout 300;
      fastcgi_buffer_size 64k;
      fastcgi_buffers 4 64k;
      fastcgi_busy_buffers_size 128k;
      fastcgi_temp_file_write_size 256k;
                fastcgi_intercept_errors on;

      gzip on;
      gzip_min_length1k;
      gzip_buffers   4 16k;
      gzip_http_version 1.1;
      gzip_comp_level 2;
      gzip_types   text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/json image/jpeg image/gif image/png font/ttf font/otf image/svg+xml application/xml+rss text/x-js;
      gzip_vary on;
      gzip_proxied   expired no-cache no-store private auth;
      gzip_disable   "MSIE \.";

      limit_conn_zone $binary_remote_addr zone=perip:10m;
                limit_conn_zone $server_name zone=perserver:10m;

      server_tokens off;
      access_log off;

server
    {
      listen 888;
      server_name phpmyadmin;
      index index.html index.htm index.php;
      root/www/server/phpmyadmin;

      #error_page   404   /404.html;
      include enable-php.conf;

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

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

      location ~ /\.
      {
            deny all;
      }

      access_log/www/wwwlogs/access.log;
    }
include /www/server/panel/vhost/nginx/*.conf;
}

hotedx 发表于 2025-1-11 18:45:08

两者只能取其一
页: [1]
查看完整版本: 伪静态与反向代理有冲突怎么解决?