Chia Sẽ Kinh Nghiệm Về IT



Tìm Kiếm Với Google
-


Gởi Ðề Tài Mới  Gửi trả lời
 
Công Cụ Xếp Bài
Tuổi 06-02-2015, 01:16 PM   #1
hoctinhoc
Guest
 
Trả Lời: n/a
how to setup nginx as a Reverse Proxy Subdirectory
how to setup nginx as a Reverse Proxy Subdirectory



1. Reverse Proxy cho Domain (Khi truy cập vào quantrinet.com nó sẽ chuyển request đến server web: quantrinet.com)


Trích dẫn:

## Basic reverse proxy server ##

## Apache (vm02) backend for quantrinet.com ##
upstream apachephp {
server 123.30.110.38; #Apache1
}

## Start quantrinet.com ##
server {
listen 125.212.219.240:80;
server_name quantrinet.com;

access_log /var/log/nginx/log/www.quantrinet.access.log main;
error_log /var/log/nginx/log/www.quantrinet.error.log;
root /usr/share/nginx/html;
index index.html index.htm;

## send request back to Real Web or Backend ##
location / {
proxy_pass http://quantrinet.com;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
## End www.quantrinet.com ##
~
2. Reverse Proxy cho Subdirectory (khi truy cập vào http://quantrinet.com/blog/ thì request sẽ chuyển qua server web: http://images.quantrinet.com/forum/)

- URL dẫn giữ ở http://quantrinet.com/blog/
- Khi cấu hình subdirectory thì máy chủ chạy web server phải có /forum/ or /log....... giống như khi truy cập subdirectory là /blog thì nginx mới hoạt động



Trích dẫn:

## Basic reverse proxy server ##
## Apache (vm02) backend for quantrinet.com ##
upstream apachephp {
server 123.30.110.38; #Apache1
}

## Start quantrinet.com ##
server {
listen 125.212.219.240:80;
server_name quantrinet.com;
access_log /var/log/nginx/log/www.quantrinet.access.log main;
error_log /var/log/nginx/log/www.quantrinet.error.log;
root /usr/share/nginx/html;
index index.html index.htm;


## Send request back to Real Web or Backend ##

location /blog {

proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://images.quantrinet.com/forum;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
## End www.quantrinet.com ##
Tham khảo

http://wiki.apache.org/couchdb/Nginx_As_a_Reverse_Proxy

http://www.cyberciti.biz/tips/using-...rse-proxy.html


  Trả lời ngay kèm theo trích dẫn này
Gửi trả lời


Công Cụ
Xếp Bài

Quyền Hạn Của Bạn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Hình Cảm xúc đang Mở
[IMG] đang Mở
Mã HTML đang Tắt




Bây giờ là 12:30 AM. Giờ GMT +7



Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.