vim /usr/local/nginx/conf/nginx.conf
# 增加
include vhost/*.conf
mkdir /usr/local/nginx/conf/vhost
vim /usr/local/nginx/conf/vhost/default.conf
# 加入
server {
listen 80 default_server; # 有这个标记的就是默认虚拟主机
server_name aaa.com; # 域名,空格隔开多个
index index.html index.htm index.php;
root /data/wwwroot/default; # 网站根目录
}
mkdir -p /data/wwwroot/default/
echo “This is a default site.”>/data/wwwroot/default/index.html
# 检查配置文件
/usr/local/nginx/sbin/nginx -t
# 重读配置文件
/usr/local/nginx/sbin/nginx -s reload