一个客户的需求,看了很多的教程,实现方式都不一样,现将我自己配置的分享给大家。

1.修改nginx配置文件

(路径/usr/local/openrestry/nginx/conf/nginx.conf)

vim /usr/local/openrestry/nginx/conf/nginx.conf)
 #添加IP至allow(例如我们将10.208.96.192和10.208.96.193加入)
location = /index.html
 { allow 10.208.96.192; 
   allow 10.208.96.193; 
   deny all; 
   root /work/weichuangli; 
  }

2.关闭并重启nginx服务

#关闭nginx服务 
/usr/local/openrestry/nginx/sbin/nginx -s stop 
#启动nginx服务 
/usr/local/openrestry/nginx/sbin/nginx -c /usr/local/openrestry/nginx/conf/nginx.conf 
#重新载入nginx配置 
/usr/local/openrestry/nginx/sbin/nginx -s reload

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐