标签:
在/usr/local/nginx/conf目录下nginx.conf文件是nginx的配置文件。
1使用nginx配置虚拟机
1.1通过端口区分虚拟机
在nginx.conf文件中添加一个Server节点,修改端口号就可以
server {
listen 81;
server_name localhost;
#charset koi8-r;
#
# #access_log logs/host.access.log main;
#
location / {
root html81;
index index.html index.htm;
}
}
http://192.168.81.128:81/
访问的是html81文件夹下的index.html文件
1.2通过域名区分虚拟机
这里我们可以通过修改host文件指定域名的ip地址完成域名解析的任务
Host文件的位置:C:\Windows\System32\drivers\etc
需要修改nginx.conf配置文件。
修改配置后需要重新加载配置文件。
此时访问
www.taobao.com/
访问的就是html-taobao文件夹下的index.html
标签:
原文地址:http://www.cnblogs.com/winner-0715/p/5933994.html