·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设问答 >> CentOS vps lnmp安装包 nginx配置emlog伪静态成功

CentOS vps lnmp安装包 nginx配置emlog伪静态成功

作者:佚名      网站建设问答编辑:admin      更新时间:2022-07-23

第三次玩弄linux vps,但却是首次成功安装程序并运行。本来是要给vps弄lamp的,但很多人说nginx小巧轻灵,占用内存小,所以就弄个lnmp安装包了。作为一名新手,搞了好多个小时才搞好,表示压力好大。

安装emlog后设置伪静态是件烦恼的事。由于第一次使用,根本就不知道在哪里添加相关规则,网上搜索了大半天,都是介绍规则的,都没有说明在哪里配置。最后搜索一位博主,才隐隐约约知道是在/usr/local/nginx/conf/nginx.conf配置,所以现在才可以正常访问。

这里顺便记录下,当学习笔记吧。

通过SSH登陆putty后,输入命令vi /usr/local/nginx/conf/nginx.conf 回车

[oot@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/*;

}

其中

location /

{

index index.php index.html;

if (! $request_filename)

{

rewrite ^/(+) /index.php last;

}

}

是emlog官方给出的location规则

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

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

转载请注明出处:哈贝车

文章地址:http://www.hapicture.com/nginx-emlog-rewrite.html