vps lnmp安装包 nginx设置emlog伪静态

时间:2020-08-01   阅读:265

在vps上使用lnmp搭建php环境安装emlog博客系统,安装后在设置伪静态时发现nginx对htaccess不支持。后来发现要在/usr/local/nginx/conf/nginx.conf手动添加相关伪静态规则进行配置,emlog官方也给出了emlog在nginx下的伪静态规则,添加后,emlog伪静态后的url可以正常访问了!

lnmp设置emlog伪静态:

通过SSH登陆putty后,输入命令vi /usr/local/nginx/conf/nginx.conf 回车,添加emlog官方给出的伪静态规则后内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[[email protected] ~]# vi /usr/local/nginx/conf/nginx.conf        {listen       80;server_name hapicture.com;index index.html index.htm index.php;include location.conf;root  /home/www;location /{index index.php index.html;if (!-e $request_filename){rewrite ^/(.+)$ /index.php last;}}}include servers/*;
}

其中以下部分是emlog官方给出的location规则

1
2
3
4
5
6
7
8
location /
 {index index.php index.html;if (!-e $request_filename){  rewrite ^/(.+)$ /index.php last;}}

添加后,按Esc退出编辑状态,然后输入:wq保存退出。

最后输入/etc/init.d/nginx restart重启nginx使配置生效。


上一篇:实现 Emlog 最新评论列表不显示博主的评论回复

下一篇:Emlog搜索框调用代码函数

网友评论