参考网址:
(1)https://blog.youkuaiyun.com/u014374031/article/details/73441577
(2)https://www.cnblogs.com/EasonJim/p/7806879.html
(3)https://jingyan.baidu.com/article/bad08e1ec2adc709c85121aa.html
常用命令:
1、启动nginx:sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
2、查看进程:ps -ef|grep nginx
3、查看ubuntu的ip:ifconfig -a。访问本地电脑ip即可访问nginx
4、关掉进程 kill —QUIT 端口号(master对应的端口号)
5、windows不能访问:防火墙问题:sudo ufw allow from 本机ip(端口号)
sudo ufw status防火墙状态
sudo ufw disable 关闭防火墙
6、域名:一个域名只能绑定一个ip
DNS就是解析域名的
7、域名配置:
(1) 修改hosts文件:windows文件目录:C:\Windows\System32\drivers\etc
在hosts文件中修改:在末尾加上域名的配置,其中192.168.130.137为ubuntu的ip
(2)然后修改ubuntu中的文件nginx.conf。其中html2、html3文件夹的位置/usr/local/nginx/conf
中,复制粘贴的HTML文件夹,修改文件夹中的html用来区分不同的域名。