- 编辑 nginx.conf
server { listen 80; server_name file.youxiu326.xin; location /image/ { #访问 file.youxiu326.xin/image/* 则访问到 /java/static/image/* root /java/static/; autoindex on; } location /file/ { #访问 file.youxiu326.xin/file/* 则访问到 /java/static/file/* root /java/static/; autoindex on; } }
- 重启nginx
[root@lihui static]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@lihui static]# nginx -s reload