1.修改nginx.conf文件
server {
listen 80;
server_name www.shea.com;
access_log logs/www.shea.log;
charset utf-8;#url匹配
location / {
#需要列出目录索引的位置
root /opt/;
#index index.html index.htm;
#开启目录索引功能
autoindex on;
}}
2.在客户端修改hosts文件
3.浏览器访问www.shea.com
还得注意虚拟机目录下不要有index.html文件,不如会优先读取index.html文件下的内容
#与服务器/opt/内容对应
[root@web01 logs]# ls /opt/
nginx nginx-1.16.0 null rh