在 LNMP 2.1 中,删除掉默认的 default 虚拟主机的流程
1、在 LNMP 2.1 中,删除掉默认的 default 虚拟主机的流程。查看目录,/home/wwwroot/default 中仅剩下 .user.ini,其他的文件已经被手动删除。如图12、参考:LNMP添加、删除虚拟主机及伪静态使用教程 https://lnmp.org/faq/lnmp-vhost-add-howto.html 。却不存在 default 虚拟主机。如图23、虽然存在文件 /usr/local/nginx/conf/nginx.conf ,其中包含 server server_name _; root /home/wwwroot/default;。决定删除掉此 server 相关的配置。如图34、.user.ini文件无法直接修改,如要修或删除需要先执行:chattr -i /home/wwwroot/default/.user.ini。 rm -f /home/wwwroot/default/.user.ini 就可以。如图45、执行 lnmp nginx reload,重新加载 Nginx 配置。
[root@iZ2zeaj7tnbv8d3gsoy1w5Z wwwroot]# cd default/
[root@iZ2zeaj7tnbv8d3gsoy1w5Z default]# ls -la
total 4
drwxr-xr-x 2 www www 23 Mar 8 19:17 .
drwxr-xr-x 4 root root 32 Mar 8 16:57 ..
-rw-r--r-- 1 root root 48 Mar 8 16:43 .user.ini
[root@iZ2zeaj7tnbv8d3gsoy1w5Z default]# pwd
/home/wwwroot/default
[root@iZ2zeaj7tnbv8d3gsoy1w5Z default]#
[root@iZ2zeaj7tnbv8d3gsoy1w5Z default]# lnmp vhost list
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
Nginx Virtualhost list:
objectapi.ikhw.cn
object.ikhw.cn
[root@iZ2zeaj7tnbv8d3gsoy1w5Z default]# chattr -i /home/wwwroot/default/.user.ini
[root@iZ2zeaj7tnbv8d3gsoy1w5Z default]# ls -la
total 4
drwxr-xr-x 2 www www 23 Mar 8 19:17 .
drwxr-xr-x 4 root root 32 Mar 8 16:57 ..
-rw-r--r-- 1 root root 48 Mar 8 16:43 .user.ini
[root@iZ2zeaj7tnbv8d3gsoy1w5Z default]# rm -f /home/wwwroot/default/.user.ini
[root@iZ2zeaj7tnbv8d3gsoy1w5Z default]# ls -la
total 0
drwxr-xr-x 2 www www 6 Mar 18 10:41 .
drwxr-xr-x 4 root root 32 Mar 8 16:57 ..
[root@iZ2zeaj7tnbv8d3gsoy1w5Z default]# cd ..
[root@iZ2zeaj7tnbv8d3gsoy1w5Z wwwroot]# ls -l
total 0
drwxr-xr-x 2 www www 6 Mar 18 10:41 default
drwxr-xr-x 4 root root 64 Mar 11 14:56 object
[root@iZ2zeaj7tnbv8d3gsoy1w5Z wwwroot]# rm -rf default/
[root@iZ2zeaj7tnbv8d3gsoy1w5Z wwwroot]# ls -la
total 0
drwxr-xr-x 3 root root 17 Mar 18 10:42 .
drwxr-xr-x. 5 root root 47 Mar 8 16:43 ..
drwxr-xr-x 4 root root 64 Mar 11 14:56 object



