nginx(4) 虚拟主机设置

1.

查看配置文件是否出错

[root@localhost nginx]# ./sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

2.

server {
  listen 80;
  server_name z.com;
  location / {
  root hello;
  index index.html;
  }
}

listen :监听的端口号

server_name: 要访问的域名

root : nginx下的一个目录

index: 目录访问下的默认页面

猜你喜欢

转载自www.cnblogs.com/mm163/p/10803159.html