V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
zijian
V2EX  ›  问与答

nginx 配置文件写法导致 s 开头的 url 页面都是 404

  •  
  •   zijian · 2020-02-10 20:21:18 +08:00 · 1332 次点击
    这是一个创建于 1508 天前的主题,其中的信息可能已经有所发展或是发生改变。
    在 wordpress (网站域名:sample.com ) 二级目录安装了另一个程序( s ),默认域名(同时也是目录)就是: sample.com/s, 现在想给二级目录这个程序开启伪静态,在 nginx 配置文件「 sample.com.conf 」填写的 include s.conf,s.conf 里是这样写的:

    location /s {

    ......
    }

    配置好重启 nginx 后,sample.com/s 的伪静态是有了,但是 sample.com 里凡是 sample.com/s 开头的页面都是 404,我的 s.conf 的“location /s”是不是哪里写的有问题,哪位懂的请指点一二,谢谢!
    5 条回复    2020-02-12 16:35:15 +08:00
    xmlf
        1
    xmlf  
       2020-02-10 22:46:08 +08:00 via Android
    那还是伪静态不成功。都 404 了,没跳转成功
    2wex
        2
    2wex  
       2020-02-11 08:46:38 +08:00
    `location /s` 的里面是不是写错了

    盲猜 你应该把`/index.php`改成`/s/index.php`
    Tezos
        3
    Tezos  
       2020-02-11 09:22:43 +08:00
    为什么不用二级域名而是二级目录
    mauve
        4
    mauve  
       2020-02-11 11:03:42 +08:00 via iPhone   ❤️ 1
    /s 改为 /s/
    zijian
        5
    zijian  
    OP
       2020-02-12 16:35:15 +08:00
    @mauve 成功了,就是写的有问题,改成 /s/就可以了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1010 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 19:26 · PVG 03:26 · LAX 12:26 · JFK 15:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.