今天我在linux系统部署nginx,在对配置文件修改的过程中没有正常保存退出nginx.conf文件,当我再次想对配置文件进行编辑的时候,提示如下信息:
1 E325: ATTENTION 2 Found a swap file by the name ".nginx.conf.swp" 3 owned by: root dated: Tue Apr 28 15:34:30 2020 4 file name: /usr/local/nginx/conf/nginx.conf 5 modified: YES 6 user name: root host name: node01 7 process ID: 22057 8 While opening file "nginx.conf" 9 dated: Mon Apr 27 17:56:15 2020 10 11 (1) Another program may be editing the same file. If this is the case, 12 be careful not to end up with two different instances of the same 13 file when making changes. Quit, or continue with caution. 14 (2) An edit session for this file crashed. 15 If this is the case, use ":recover" or "vim -r nginx.conf" 16 to recover the changes (see ":help recovery"). 17 If you did this already, delete the swap file ".nginx.conf.swp" 18 to avoid this message. 19 "nginx.conf" 185L, 4419C 20 Press ENTER or type command to continue
根据他的提示可以看出上一次为正常关闭在本地形成了一个隐形文件“.nginx.conf.swp”,想要正常编辑不再提示这一堆的信息,需要删除掉这个文件:
在配置文件所在的目录执行命令 rm .nginx.conf.swp
删除成功之后再次编辑就不会再报错啦!