vps lnmp安装包 nginx设置emlog伪静态
网站文章 2026-09-21 08:37:23 4 0

在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
[root@hapicture ~]# 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使配置生效。

文章说明
本文标签:
©版权声明
本站提供的一切软件、教程和游戏辅助仅限用于娱乐和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络收集,版权争议与本站无关。如有侵权请邮件与我们联系处理。敬请谅解!6594404@qq.com