我已经在centos服务器上部署了我的laravel应用程序,我不得不在httpd.conf中添加下面提到的行以使其正常工作
<Directory "/var/www/html/ezschedular2/public">
Allowoverride All
</Directory>
我们现在决定使用nginx
,这些行的替代是什么?我必须在文件夹default.conf
/etc/nginx/conf.d
上添加其他行
答案 0 :(得分:0)
这是我为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;
}
}