Jump to content
PHP論壇人

vBulletin 6.0 Nginx 伪静态 真实配置文件


二戒

Recommended Posts

贴一个我自己的真实配置文件:

server {
    listen 80;
    server_name  d.hxzylt.com;
    rewrite ^ https://$server_name$request_uri? permanent; 
}

server
  {
  listen 443 ssl;
  listen 443 quic reuseport;
  server_name  d.hxzylt.com;
  ssl_certificate      /etc/pki/tls/certs/hxzylt/hxzylt.com.crt;
  ssl_certificate_key  /etc/pki/tls/certs/hxzylt/hxzylt.com.key;
  add_header Alt-Svc 'h3=":443"';
  add_header QUIC-Status $http3;
  add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
  add_header Content-Security-Policy-Report-Only "default-src https:; script-src https: 'unsafe-eval' 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data:; font-src https: data:";

    index index.php index.html index.htm;
#    proxy_redirect              off;
#    proxy_set_header            Host $host;
#    proxy_set_header            X-real-ip $remote_addr;
#    proxy_set_header            X-Forwarded-For $proxy_add_x_forwarded_for;
#    real_ip_header X-Forwarded-For;
     add_header X-Frame-Options "SAMEORIGIN";

   # Allow only GET,POST to visit website 
        if ($request_method !~* GET|POST) {
            return 403;
        }

    root  /website/hxzylt/xf;
    
    # configuration rules
        # legacy css being handled separate for performance
        location = /css\.php {
                rewrite ^ /core/css.php break;
        }

        # make install available from presentation
        location ^~ /install {
                rewrite ^/install/ /core/install/ break;
        }

        # any request to not existing item gets redirected through routestring
        location / {
                if (!-f $request_filename) {
                        rewrite ^/(.*)$ /index.php?routestring=$1 last;
                }
        }

        # make admincp available from presentation
        location ^~ /admincp {
                if (!-f $request_filename) {
                        rewrite ^/admincp/(.*)$ /index.php?routestring=admincp/$1 last;
                }
        }

 # process any php scripts, not found gets redirected through routestring
        location ~ \.php$ {
                # handles legacy scripts
                if (!-f $request_filename) {
                        rewrite ^/(.*)$ /index.php?routestring=$1 break;
                }
        root  /website/hxzylt/xf;
    fastcgi_pass   127.0.0.1:9001;
    #fastcgi_pass   unix:/var/opt/remi/php80/run/php-fpm/www.sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;

    brotli on;
    brotli_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/octet-stream;

    gzip on;
    gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/octet-stream;

#    expires 3d;
    }
   }

Edited by Jack
Link to comment

vb6的rewrite就是这部分,看准位置:

# configuration rules
        # legacy css being handled separate for performance
        location = /css\.php {
                rewrite ^ /core/css.php break;
        }

        # make install available from presentation
        location ^~ /install {
                rewrite ^/install/ /core/install/ break;
        }

        # any request to not existing item gets redirected through routestring
        location / {
                if (!-f $request_filename) {
                        rewrite ^/(.*)$ /index.php?routestring=$1 last;
                }
        }

        # make admincp available from presentation
        location ^~ /admincp {
                if (!-f $request_filename) {
                        rewrite ^/admincp/(.*)$ /index.php?routestring=admincp/$1 last;
                }
        }

 # process any php scripts, not found gets redirected through routestring
        location ~ \.php$ {
                # handles legacy scripts
                if (!-f $request_filename) {
                        rewrite ^/(.*)$ /index.php?routestring=$1 break;
                }

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...