-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathreverse-proxy.conf
81 lines (67 loc) · 2.21 KB
/
reverse-proxy.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# ---
# Reverse Proxy Configuration
# ---
upstream upstream.server {
# source server
server loadb01.live.com.au:80;
}
server {
listen 80;
# ---
# The server name (or names) that you are going to put this site live as...
# ---
server_name www.mywebsite.com;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
location / {
# redirect non-www to www.
if ($http_host ~* "^mywebsite.com"){
rewrite ^(.*)$ http://www.live.com.au$1 redirect;
}
proxy_pass http://upstream.server;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
# ---
# Change the host here to rewrite the hostname on the main server server
# ---
proxy_set_header Host loadb01.live.com.au;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /blog {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /blog/index.php?$args;
root /srv/html;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /srv/html/$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
#fastcgi_pass 127.0.0.1:9000;
#index index.html index.htm;
index index.php;
}
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
root /usr/share/nginx/html;
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME /srv/html/$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
}
}