配置过程如下 [root@localhost ~]# vi /etc/nginx/nginx.conf server { listen 80 default; server_name _; return 403; } server { listen 80; server_name www.test.com; location / { root /usr/share/nginx/html/; index index.html index.htm; } } 访问测试 域名访问 IP地址访问