1.基于域名的虚拟主机
vim /usr/local/nginx/conf/nginx.conf
复制一个
cd /var/www/html/
mkdir kgc accp
cd kgc/
vim index.html
this is kgc!
cd ..
cd accp
this is accp!
vim /etc/hosts
systemctl restart nginx
2.基于ip的虚拟主机
ifconfig ens33:0 192.168.233.100/24
vim /nginx.conf
3.基于端口的虚拟主机
4.基于授权的访问控制
yum install -y httpd-tools
htpasswd -c /usr/local/nginx/passwd.db zhangsan
chown nginx /usr/local/nginx/passwd.db
chmod 400 /usr/local/nginx/passwd.db
vim nginx.conf
systemctl restart nginx
5.基于客户端的访问控制
vim nginx.conf