gpt4 book ai didi

apache - 将 Laravel 项目从 Apache 迁移到 Nginx

转载 作者:行者123 更新时间:2023-12-04 19:44:13 33 4
gpt4 key购买 nike

我已经在 centos 服务器上部署了我的 laravel 应用程序,我必须在 httpd.conf 中添加下面提到的行以使其工作

<Directory "/var/www/html/ezschedular2/public">
Allowoverride All
</Directory>

我们决定使用 nginx现在,这些行的替代品是什么?我必须在 default.conf 上添加这些行的替代品在文件夹 /etc/nginx/conf.d

最佳答案

这是我为 Laravel 配置的 nginx。更改变量以满足您的需要

server {
listen 80;
server_name YOURSERVERNAME_OR_IP;
root YOUR_PATH_TO_LARAVEL_PUBLIC_FOLDER;

index index.html index.htm index.php;

charset utf-8;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

关于apache - 将 Laravel 项目从 Apache 迁移到 Nginx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39040385/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com