TP框架的pathinfo
2023-12-14 本文已影响0人
Mracale
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
root /var/www/html/public;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
# 去掉url中的index.php
location / {
try_files $uri $uri/ =404;
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?s=/$1 last;
}
}
# pass PHP scripts to FastCGI server
location ~ \.php(.*)$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $1;
}
}