基于域名
cd /usr/local/nginx/html/
mkdir aaa
mkdir bbb
echo www.aaa.com > aaa/index.html
echo www.bbb.com > bbb/index.html
vim /usr/local/nginx/conf/nginx.conf
修改server中的配置
 server {
    listen 80;
    server_name www.benet.com;
    charset utf-8;
    access_log logs/benet.access.log;
    location / {
     root /usr/local/nginx/html/benet;
     index index.html index.php;
       } 
server {
    listen 80;
    server_name www.bbb.com;
    charset utf-8;
    access_log logs/bbb.access.log;
    location / {
     root  /usr/local/nginx/html/bbb;
     index index.html index.php;
       }
     }第二个的网页的配置代码
/etc/init.d/nginx restart
echo "192.168.254.10 www.aaa.com" >> /etc/hosts
echo "192.168.254.10 www.bbb.com" >> /etc/hosts
你的ip 你的域名
# 由于没有做dns只能修改自身的hosts文件
 
基于端口
vim /usr/local/nginx/conf/nginx.conf
 
 
只需修改端口

基于ip
ifconfig ens33:0 192.168.254.12/24
配置一个子接口

 
 
 



















