php 项目部署到宝塔Nginx
作者:
风度翩翩的程序猿 | 来源:发表于
2023-04-06 20:26 被阅读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
本文标题:php 项目部署到宝塔Nginx
本文链接:https://www.haomeiwen.com/subject/qmiuddtx.html
网友评论