LNMP布置thinkphp5
在LNMP环境下布置tp5程序。先配置nginx.conf:
server {
listen 80;
server_name www.xtwanwan.info;
location / {
root html/www/public;
index index.php index.html index.htm;
if (!-e $request_filename) {//因为tp5没有?所以这里需要这样
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root html/www/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
....
}
还有就是服务器的php版本要>5.4版本注意文件权限,我的样式完整路径为http://www.xxx.com/static/index/css/home.css,注意大小写问题基本就可以了。