在nginx上面装了tp5,发现路由怎么也不对,重写规则怎么写也不对,有遇到过相同问题的人吗?顺便问一下php程序员需要对nginx很熟悉吗?nginx学习怎样的路线会比较好点?
你可以参考下一下这篇文章的 https://blog.chenishr.com/?p=623 配置:
server {
listen 80;
server_name tp5.loc;
set $vhost_path tp5/public;
location / {
root /usr/share/nginx/html/$vhost_path;
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
location ~ ^(.+\.php)(.*)$ {
root /var/www/html/$vhost_path;
fastcgi_pass phpfpm:9000;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
}