Bludit的nginx配置

Bludit的nginx配置

Bludit 是一款轻量博客程序,在 Nginx 下需要配置伪静态,否则安装后打开 /admin 等页面会报 404。下面这段配置加进 Nginx 的 server 配置即可。

Nginx 配置

location / {try_files $uri $uri/ /index.php?$args;}location ^~ /bl-content/tmp/ { deny all; }location ^~ /bl-content/pages/ { deny all; }location ^~ /bl-content/databases/ { deny all; }

说明与注意事项

  • 第一条 location 用 try_files 实现伪静态:先找真实文件或目录,找不到则交给 /index.php 处理。
  • 后三条 location 禁止通过 Web 直接访问 bl-content 下的 tmp、pages、databases 目录,避免数据文件被下载。
  • 配置加进站点的 server 块后,检查并重载 Nginx 配置(如 nginx -t && nginx -s reload)才能生效。

留下评论