Welcome! Log In Create A New Profile

Advanced

Re: Настроить редирект + прокси

January 17, 2011 02:38AM
[code]
# cat nginx.conf
user root;

worker_processes 3;
error_log /var/log/nginx/error.log info;
pid /var/log/nginx/nginx.pid;

events {
worker_connections 1024;
use epoll;
}

http {

include /usr/local/nginx/conf/mime.types;
default_type application/octet-stream;


log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;

sendfile on;
tcp_nopush on;
tcp_nodelay on;

server {
server_name www.domain.ru;
listen 443 default; # что слушать
keepalive_timeout 70;
# запросы к / перенаправлять на webexecuter
rewrite ^/$ /bg/webexecuter last;

# ко всем запросам добавлять префикс /bg
rewrite ^/(.*)$ /bg/$1 last;

ssl on;
ssl_certificate /usr/local/nginx/conf/cert.pem;
ssl_certificate_key /usr/local/nginx/conf/cert.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;

error_page 403 /usr/local/nginx/html/403.html;
access_log logs/host.access.log main;


location ~ /\.ht {
deny all;
}

location /bg/executer {
deny all;
}

location ~ ^.*/bg/mpsexecuter {
deny all;
}
location /bg {
proxy_pass https://10.0.0.1:8443; # куда проксировать
proxy_redirect https://www.domain.ru/bg /;
}

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 10m;
client_body_buffer_size 128k;

proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;

proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
server {
listen 80;
server_name inf.domain.ru;
keepalive_timeout 70;

access_log /var/log/nginx/host.access.log main;

# запросы к / перенаправлять на webexecuter
rewrite ^/$ /bg/webexecuter last;

# ко всем запросам добавлять префикс /bgbilling
rewrite ^/(.*)$ /bg/$1 last;


location /bg/ {
proxy_pass http://10.0.0.1:8081;
proxy_redirect http://inf.domain.ru/bg /;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
server {
listen 80;
server_name domain.ru;
location / {
rewrite ^/(.*)$ https://www.domain.ru/$1 permanent;
allow all;
}

}
server {
listen 80;
server_name www.domain.ru;
location / {
rewrite ^/(.*)$ https://www.domain.ru/$1 permanent;
allow all;
}

}
}
[/code]
Subject Author Posted

Настроить редирект + прокси

skyb January 17, 2011 12:52AM

Re: Настроить редирект + прокси

Andrew Kopeyko January 17, 2011 01:46AM

Re: Настроить редирект + прокси

skyb January 17, 2011 02:00AM

Re: Настроить редирект + прокси

skyb January 17, 2011 02:02AM

Re: Настроить редирект + прокси

skyb January 17, 2011 02:17AM

Re: Настроить редирект + прокси

Igor Sysoev January 17, 2011 02:22AM

Re: Настроить редирект + прокси

skyb January 17, 2011 02:25AM

Re: Настроить редирект + прокси

skyb January 17, 2011 02:38AM

Re: Настроить редирект + прокси

Igor Sysoev January 17, 2011 02:30AM

Re: Настроить редирект + прокси

kav January 17, 2011 03:02PM

Re: Настроить редирект + прокси

skyb January 17, 2011 02:45AM

Re: Настроить редирект + прокси

skyb January 17, 2011 03:43AM

Re: Настроить редирект + прокси

Igor Sysoev January 17, 2011 03:16AM

Re: Настроить редирект + прокси

Kirill A. Korinskiy January 17, 2011 03:18PM

Re: Настроить редирект + прокси

Sergey Averyanov January 17, 2011 04:22PM

Re: Настроить редирект + прокси

Sergey Averyanov January 17, 2011 05:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 81
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready