thinkphp5 nginx 路由问题

一、修改nginx 配置文件

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

server {

listen 888;

server_name www.域名.com;

index index.html index.htm index.php;

root /www/wwwroot/文件根目录;

 

#error_page 404 = /404.html;

#error_page 502 = /502.html;

 

if (!-e $request_filename) {

rewrite ^/(.*)$ /index.php/$1 last;

break;

}

 

location ~ [^/]\.php(/|$) {

 

fastcgi_split_path_info ^(.+\.php)(/.+)$;

try_files $fastcgi_script_name =404;

set $path_info $fastcgi_path_info;

fastcgi_param PATH_INFO $path_info;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

 

include fastcgi.conf;

 

}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {

expires 30d;

access_log off;

}

location ~ .*\.(js|css)?$ {

expires 7d;

access_log off;

}

location ~ /\.ht {

deny all;

}

}

  二、伪静态

thinkphp5 nginx 路由问题插图

 

1

2

3

4

5

location / {

if (!-e $request_filename){

rewrite ^(.*)$ /index.php?s=$1 last; break;

}

}

没有账号? 忘记密码?

社交账号快速登录