二戒 发布于2023年9月16日 分享 发布于2023年9月16日 (已编辑) 贴一个我自己的真实配置文件: 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; } } 本帖最后于4月18日,由Jack编辑 意见的链接 分享到其他网站 更多分享选项…
二戒 发布于2023年9月16日 楼主 分享 发布于2023年9月16日 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; } 意见的链接 分享到其他网站 更多分享选项…
推荐的帖子
创建帐户或登录后发表意见
你需要成为会员才能发表意见
创建帐户
在我们的论坛注册新帐户,只需要几个简单步骤!
注册帐户登录
已有帐户?请登录。
立刻登录