1.下载pagekit
官方网站:https://pagekit.com/
2.解压及安装依赖库
unzip pagekit-1.0.12.zip -d pagekit
cd pagekit
composer install
3.添加vhost
lnmp vhost add
输入相应的域名即可
打开新增的配置文件 域名.config 添加一下几行
(伪静态规则、svg访问、Pagekit 并没有限制 pagekit.db 等私密文件的访问,就会导致关键文件会被下载,因此我们需要规避这些操作)
location /
{
try_files $uri $uri/ /index.php?$query_string;
}
location ~* .(eot|otf|ttf|woff|svg)$ {
add_header Access-Control-Allow-Origin ;
}
location ~ /(composer.lock|pagekit.db|installed.json|composer.json|package.json|bower.json|CHANGELOG.md|README.md|gulpfile.js|webpack.config.js|pagekit)
{
deny all;
}
location ~ .php(.)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
4.修改fastcgi_param添加下边代码
fastcgi_param HTTP_MOD_REWRITE On;
如图:
5.重启nginx
lnmp nginx restart
ok了