当前位置: 首页 > 后端技术 > PHP

Nginx(alias和root的区别)

时间:2023-03-29 22:30:02 PHP

Nginx(alias和root的区别)1.alias和root的区别:location/request_path/image{  root/local_path/image/;}#访问一个测试。html查看文件时显示的路径为:http://xxxx.com/request_path/...;location/request_path/image{  alias/local_path/image/;}#访问test.html文件时,显示的路径为:http://xxxx.com/local_path/im...;也就是区别在于location后面的path2没有显示在alias中。我想获取用户的真实IP是因为经过多层代理后,用户的真实IP会被代理IP覆盖,所以在第一个代理服务器中设置:setx_real_ip=$remote_addrandget$x_real_ip=IP1in最后一个代理服务器,这样就可以直接在php中执行获取用户的IP