domain based
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
Modify the configuration in the server
server {
listen 80;
server_name www.aaa.com;
charset utf-8;
access_log logs/benet.access.log;
location / {
root /usr/local/nginx/html/aaa;
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;
}
}
The configuration code of the second web page
/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
your ip your domain name
# Since there is no dns, you can only modify your own hosts file
port based
vim /usr/local/nginx/conf/nginx.conf
Just modify the port
based on ip
ifconfig ens33:0 192.168.254.12/24
configure a subinterface