MENU

如何在LNMP环境下安装Flarum论坛

February 25, 2017 • Read: 3106 • 网络笔记

前言

最近朋友一直在问我,Flarum论坛怎么在LNMP环境中安装呢?因为他安装后很明显的打不开后台,这就是一个比较尴尬的事情。

在后来翻阅官方文档后,这个问题就变的so 简单。

错误信息

打开后台出现404 分类无法打开 只有首页能进去

错误解决

在Nginx下修改规则配置 将下面一段代码添加进你的服务器配置
location / { try_files $uri $uri/ /index.php?$query_string; }
location /api { try_files $uri $uri/ /api.php?$query_string; }
location /admin { try_files $uri $uri/ /admin.php?$query_string; }

location /flarum {
    deny all;
    return 404;
}

location ~* \.php$ {
    fastcgi_split_path_info^(.+.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTP_PROXY ""; # Fix for https://httpoxy.org/ vulnerability
    fastcgi_index index.php;
}

location ~* \.html$ {
    expires -1;
}

location ~* \.(css|js|gif|jpe?g|png)$ {
    expires 1M;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
要记住重启服务器使Nginx配置生效!

最后编辑于: March 16, 2017
Archives QR Code Tip
QR Code for this page
Tipping QR Code
Leave a Comment

已有 3 条评论
  1. Hello friends!
    I am an official representative of private company which deals with all kinds of written work (essay, coursework, dissertation, presentation, report, etc) in short time.
    We are ready to offer a free accomplishment of written work hoping for further cooperation and honest feedback about our service.
    This offer has limited quantities!!!
    Details on our website:
    https://essay-edu.biz

  2. amerifat amerifat

    不管用,直接导致nginx掉线。

    1. @amerifat是否是nginx有大括号之类的没有看到? 复制一下nginx报错信息