-->

nginx(4) 虚拟主机设置

2020-10-28 20:39发布

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;
  access_log  logs/host.access.log  main;   location
/ {   root hello;   index index.html;   } }

listen :监听的端口号

server_name: 要访问的域名

root : nginx下的一个目录

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

access_log :定义自定义日志 采用main格式

标签: