配置范例站点站点
序号
域名
目录
1
www.heytool.com
/www/html/www.heytool.com
2
bbs.heytool.com
/www/html/bbs.heytool.com
修改nginx 配置文件:
# vi nginx.conf
user nobody nobody; # 运行 nginx 的所属组和所有者
Nginx 启动关闭
# /usr/local/nginx-1.0.6/sbin/nginx //启动 nginx
# /usr/local/nginx-1.0.6/sbin/nginx –t //测试 nginx 配置文件的准确性
# /usr/local/nginx-1.0.6/sbin/nginx –s reload //重载 nginx
# /usr/local/nginx-1.0.6/sbin/nginx –s stop //关闭 nginx
测试
创建测试站点
# mkdir –p /www/html/www.heytool.com
# mkdir –p /www/html/bbs.heytool.com
# echo “www.heytool.com” > /www/html/www.heytool.com/index.html
# echo “bbs.heytool.com” > /www/html/bbs.heytool.com/index.html
启动nginx
# /usr/local/nginx-1.0.6/sbin/nginx –t //看到 ok 和 successful,说明配置文件没问题
nginx: the configuration file /usr/local/ nginx-1.0.6/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/ nginx-1.0.6/conf/nginx.conf test is successful
# /usr/local/nginx-1.0.6/sbin/nginx
绑定hosts,测试
把两个域名指向 192.168.1.202
192.168.1.202 www.heytool.com
192.168.1.202 bbs.heytool.com
打开 www.heytool.com,如下图:
nginx
打开 bbs.heytool.com,如下图:
nginx
完毕!!!!
原文地址:https://www.cnblogs.com/mmdln/p/8949924.html