V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
albert0yyyy
V2EX  ›  NGINX

使用相对地址软连接到/etc/nginx/site-enabled/xxx.conf 无法通过测试

  •  
  •   albert0yyyy · 2023-01-07 19:24:11 +08:00 · 644 次点击
    这是一个创建于 477 天前的主题,其中的信息可能已经有所发展或是发生改变。

    比如当前目录有 nginx 配置文件

    t.conf

    我使用:

    ln -s t.conf /etc/nginx/site-enabled/xxx.conf

    nginx -t

    报错 1:Too many levels of symbolic links

    报错 2:No such file or directory

    使用绝对地址或者硬连接就不报错,真心求教

    momocraft
        1
    momocraft  
       2023-01-07 19:43:31 +08:00   ❤️ 1
    file /etc/nginx/site-enabled/xxx.conf 同样会递归找不到文件
    需要理解软链接
    momocraft
        2
    momocraft  
       2023-01-07 19:44:07 +08:00
    #1 的补充: 如果 file 不报错 cat 应该能看到错误
    leoleoasd
        3
    leoleoasd  
       2023-01-07 20:08:21 +08:00   ❤️ 1
    软链接的时候,如果写相对路径,相对的应该是链接所在的路径? 你这样相当于把 /etc/nginx/site-enabled/xxx.conf 链接到 /etc/nginx/site-enabled/t.conf ? 改成完整路径试试?
    leoleoasd
        4
    leoleoasd  
       2023-01-07 20:08:47 +08:00
    跟你当前在哪个路径应该是没关系的
    albert0yyyy
        5
    albert0yyyy  
    OP
       2023-01-07 20:16:46 +08:00
    @leoleoasd 原来如此,我明白了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1081 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:35 · PVG 02:35 · LAX 11:35 · JFK 14:35
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.