Nginx(alias 和 root的區別)
1.alias 和 root 的區別:
location /request_path/image {
root /local_path/image/;
}
#訪問一個test.html文件時,顯示的路徑是:http://xxxx.com/request_path/...;
location /request_path/image{
alias /local_path/image/;
}
#訪問一個test.html文件時,顯示的路徑是:http://xxxx.com/local_path/im...;
也就是差異在 alias沒顯示 location后面的路徑
2,.想要獲取用戶的真實IP
因為經過多層代理后,用戶的真實IP會被代理IP覆蓋掉的,所以在第一個代理服務器中設置:
set x_real_ip=$remote_addr
並在最后一個代理服務器獲取
$x_real_ip=IP1
這樣就可以直接在php里執行獲取到用戶的IP了
