惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
P
Proofpoint News Feed
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog
F
Fortinet All Blogs
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
C
Check Point Blog
Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏
月光博客
月光博客
美团技术团队
D
Docker
博客园 - Franky
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

Impath's Isle

抛物线 Ⅱ | Impath 砚西记·旸 | Impath Windows 下 Gram 编辑器折腾记录 | Impath 砚西记·衡 | Impath 抛物线 | Impath's Isle 宜兴社会实践游记 | Impath's Isle 砚西记·博徒 | Impath's Isle 砚西记·序 | Impath's Isle 写在丙午马年之前 | Impath's Isle 砚西记·曙 | Impath's Isle 笔记:左手双金定则 | Impath's Isle 江南大学社会实践琐记 | Impath's Isle mdBook:使用 Pandoc 快速创建高质量 PDF 电子书 | Impath's Isle Windows 下 Rust 开发环境部署:GNU 工具链及镜像优化 | Impath's Isle 使用 MSYS2 部署 Windows 下 GCC 开发环境 | Impath's Isle 二 | Impath 砚西记·志涵 | Impath's Isle 砚西记·鹏钧 | Impath's Isle 砚西记·邹昱 | Impath's Isle 一 | Impath 2025 春学期研究性学习项目大纲 | Impath's Isle 2024 秋学期研究性学习总结 | Impath 无锡市业余无线电入门指北(旧版) | Impath's Isle
LNMP 环境下 Typecho 后台 404 的一般解决方案 | Impath's Isle
Impath · 2025-08-10 · via Impath's Isle

手动配置 LNMP 并部署 Typecho 时,后台会出现 404。最终测试可用解决方案记录如下,便于日后查阅。

  1. 打开虚拟主机配置文件
    文件位于 /etc/nginx/sites-available/,并在 /etc/nginx/sites-enabled/ 建立了同名符号链接。

  2. 用以下内容覆盖原文件(修改域名、路径等参数):

server {
    listen 80;
    server_name example.com;   # 替换为网站域名
    root /var/www;                   # 替换为你的Typecho安装路径

    index index.php index.html;

    location / {
        try_files $uri $uri/ @rewrite;    # 关键:路由重定向
    }

    location @rewrite {
        rewrite ^/(.*)$ /index.php/$1;  # 将请求重写到index.php
    }

    location ~ [^/]\.php(/|$) {
        include fastcgi_params;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;  # 或127.0.0.1:9000
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;         # 解析PathInfo
    }
}
  1. 重启 Nginx :
systemctl restart nginx