php 项目部署到宝塔Nginx

2023-04-06  本文已影响0人  风度翩翩的程序猿
部署到宝塔Nginx php项目会报404 ,配置下就行了

在站点配置

location /{
        if ($request_method = 'OPTIONS') {
          #主要是定义请求响应头问题(跨域)
          add_header 'Access-Control-Allow-Origin' * always;
          add_header 'Access-Control-Allow-Headers' * always;
          add_header 'Access-Control-Allow-Methods' * always ;
          add_header 'Access-Control-Expose-Headers' 'Authorization' always;
          return 204;
    } 
        root /www/wwwroot/xx.xx.xx.com/public;#项目根目录
        index index.html index.htm index.php;
        try_files $uri $uri/ /index.php$is_args$query_string;  #laravel项目布署后404需要加上
      }
1680870343025.jpg
上一篇 下一篇

猜你喜欢

热点阅读