不要惊慌 !Swap file "/etc/nginx/.nginx.conf.swp" already exists!

解决的方案:

首先我们要知道为什么出现这样的情况:

在写的过程中发生了意外断电,链接失效,ssh客户端异常关闭等等,服务器备份了写的操作,但是未写入真正的文件里面

如果登录编辑,发现会有以下选项

E325: ATTENTION
Found a swap file by the name "/etc/nginx/.nginx.conf.swp"
          owned by: root   dated: Sat Aug 10 10:49:36 2019
         file name: /etc/nginx/nginx.conf
          modified: no
         user name: root   host name: SHUN
        process ID: 10242 (still running)
While opening file "/etc/nginx/nginx.conf"
             dated: Sat Aug 10 10:32:46 2019

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r /etc/nginx/nginx.conf"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/etc/nginx/.nginx.conf.swp"
    to avoid this message.

Swap file "/etc/nginx/.nginx.conf.swp" already exists!

但是由于写的过程中客户端连接失效了,内容可以重写

我们可以将

/etc/nginx/.nginx.conf.swp 

这个文件保存下来

mv /etc/nginx/.nginx.conf.swp /etc/nginx/nginx_swp_bak.conf

然后再重新编辑,就可以了

vim /etc/nginx/nginx.conf

至于保存的那个文件看情况,没啥用处就rm 掉

  • 5
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

千码君2016

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值