今天我在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
刪除成功之后再次編輯就不會再報錯啦!