无法更改默认根位置

我有以下configuration文件:

# /etc/nginx/nginx.conif # vim: ts=4 user nginx; worker_processes 1; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; # Load config files from the /etc/nginx/conf.d directory # The default server is in conf.d/default.conf include /etc/nginx/conf.d/*.conf; server { charset utf-8; location / { root /data/www; } } } 

/ data / www中有两个文件:hello.txt和index.html。 但是,当我只键入我的服务器的IP时,显示默认的nginx索引页面,并输出“找不到您正在查找的页面”。 查询“ http://IPaddress.gov/hello.txt ”后。

日志:

2014/07/27 21:54:59 [error] 9070#0:* 6 open()“/usr/share/nginx/html/hello.txt”failed(2:No such file or directory),client:clientIP ,服务器:_,请求:“GET / hello.txt HTTP / 1.1”,主机:“hostIP”

如何解决我的问题?

您应该编辑/etc/nginx/conf.d/default.conf文件,并更改该文件中的默认虚拟主机设置。