问题
I have deployed my laravel app on a centos server and I had to add below mentioned lines in httpd.conf to make it work
<Directory "/var/www/html/ezschedular2/public">
Allowoverride All
</Directory>
We have decided to use nginx now, what is the alternate of these lines? I have to add alternate of these lines on default.conf in folder /etc/nginx/conf.d
回答1:
This is my nginx config for Laravel. Change variable suit your need
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;
}
}
来源:https://stackoverflow.com/questions/39040385/moved-laravel-project-from-apache-to-nginx