1.在nginx的配置里面,进行重定向

vi /etc/nginx/conf.d/default.conf

2.进入编辑

location /thinkphp/public {
        if (!-e $request_filename){
            rewrite ^/thinkphp/public/(.*)$ /thinkphp/public/index.php?s=$1 last;
        }
    }

这样访问ip/thinkphp/public/index/index/index,会报404,但是会转去请求

/thinkphp/public/index.php/index/index/index再返回,就能显示正确的数据了
/thinkphp/public/可以根据你自己写的目录进行修改配置,想写到里面就写到哪里,并不受约束,在nginx的配置里面替换掉就可以了
就在这个thinkphp框架里面,写对数据库的操作,和请求的url

3.重启服务器

service nginx restart

 


 
                    
            
                

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2021-08-26
  • 2021-12-12
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
猜你喜欢
  • 2021-11-25
  • 2022-01-18
  • 2021-05-03
  • 2022-12-23
  • 2021-06-04
  • 2021-09-11
相关资源
相似解决方案