可以了 ,伪静态规则没写对,
server {
listen 81 default_server;
listen [::]:81 default_server;
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
root /var/www/maccms10;
index index.html index.php index.htm index3.html;
server_name _;
if (!-e $request_filename) {
rewrite ^/index.php(.)$ /index.php?s=$1 last;
rewrite ^/admin.php(.)$ /admin.php?s=$1 last;
rewrite ^/api.php(.*)$ /api.php?s=$1 last;
rewrite .*$ /index.php?s=$1 last;
break;
}
location / {
try_files $uri $uri/ =404;
}
location ~ .*\.php(\/.*)*|.html$ {
include snippets/fastcgi-php.conf;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
include /etc/nginx/locations.d/*;
}
出错这里;
rewrite ^/admin.php(.*)$ /admin.php?s=$1 last;
admin.php要改成和网页的一致:如下;
rewrite ^/admincms.php(.*)$ /admincms.php?s=$1 last;