Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Настроить редирект + про кси
[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]
Posted at Nginx Forum:
http://forum.nginx.org/read.php?21,166833,166852#msg-166852
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru
|