第一步配置nginx.conf

   

server {        listen       80;        server_name  localhosttest.com;        #新配置的root路径        root         /usr/html/wwww;        #charset koi8-r;        #access_log  logs/host.access.log  main;        location / {           #注释掉原root路径,使用上面配置的root路径           # root   html;            index  index.html index.htm;        }        #匹配错误页面        error_page  404              /404.html;        # redirect server error pages to the static page /50x.html        #        error_page   500 502 503 504  /50x.html;        location = /50x.html {            #root   html;        }

   第二步配置新的root

[root@localhost wwww]# mkdir /usr/html/wwww -pv[root@localhost wwww]# vim index.html    
New Document
这是第一个HTML

   第三步配置hosts

[root@localhost wwww]# vim /etc/hosts127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 localhosttest.com::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

   第四步重启Nginx:

[root@localhost nginx]# kill -HUP $(cat /var/run/nginx/nginx.pid)访问:http://localhosttest.com