nginx syntax tweaks
This commit is contained in:
parent
f9f5856d2b
commit
30176160e6
1 changed files with 61 additions and 28 deletions
|
@ -1,10 +1,11 @@
|
|||
user www-data;
|
||||
worker_processes 1;
|
||||
user www-data www-data;
|
||||
worker_processes 2;
|
||||
|
||||
error_log /var/log/nginx/error.log;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
# max clients = worker_processes * worker_connections
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
@ -26,6 +27,7 @@ http {
|
|||
gzip_buffers 4 8k;
|
||||
# text/html is added gzip_types by default
|
||||
gzip_types text/plain application/x-javascript application/x-shockwave-flash text/css;
|
||||
|
||||
#NO CGI SUPPORT IN NGINX fix stat .pl later
|
||||
|
||||
upstream web_backend {
|
||||
|
@ -103,22 +105,16 @@ http {
|
|||
server 10.0.0.12:8005;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name .openstreetmap.org api.openstreetmap.org;
|
||||
server {
|
||||
listen 80;
|
||||
server_name .openstreetmap.org api.openstreetmap.org;
|
||||
root /home/rails/public;
|
||||
index index.html;
|
||||
access_log /var/log/nginx/openstreetmap.org.access.log;
|
||||
|
||||
if ($host ~* api\.(.*)) {
|
||||
rewrite ^/(0\.[0-9]+)/(.*)$ /api/$1/$2
|
||||
}
|
||||
|
||||
location / {
|
||||
deny 143.210.16.160;
|
||||
allow all;
|
||||
}
|
||||
access_log /var/log/nginx/openstreetmap.org.access.log;
|
||||
|
||||
include /etc/nginx/fastcgi_params;
|
||||
|
||||
#Redirect Historical Links to correct servers
|
||||
location /trac/ {
|
||||
rewrite ^/trac/(.*)$ http://trac.openstreetmap.org/$1 permanent;
|
||||
}
|
||||
|
@ -126,39 +122,77 @@ http {
|
|||
location /wiki/ {
|
||||
rewrite ^/wiki/(.*)$ http://wiki.openstreetmap.org/$1 permanent;
|
||||
}
|
||||
|
||||
|
||||
location / {
|
||||
deny 143.210.16.160;
|
||||
deny 69.89.21.73;
|
||||
deny 91.89.145.219;
|
||||
deny 195.190.169.111;
|
||||
deny 84.237.213.10;
|
||||
deny 70.22.219.249;
|
||||
deny 83.226.40.87;
|
||||
deny 82.178.145.87;
|
||||
deny 91.78.50.134;
|
||||
deny 91.77.7.139;
|
||||
deny 85.126.23.106;
|
||||
deny 213.171.196.166;
|
||||
deny 81.151.8.64;
|
||||
deny 130.226.235.215;
|
||||
deny 141.99.254.253;
|
||||
deny 61.228.43.32;
|
||||
allow all;
|
||||
}
|
||||
|
||||
#Handle api.openstreetmap/ -> api.openstreetmap/api/
|
||||
if ($host ~* api\.(.*)) {
|
||||
rewrite ^/(0\.[0-9]+)/(.*)$ /api/$1/$2
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
include /etc/nginx/fastcgi_params;
|
||||
if ($http_user_agent = "tilesAtHome") {
|
||||
if ($http_user_agent ~ "^tilesAtHome") {
|
||||
#deny all;
|
||||
fastcgi_pass tah_backend;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
location ~ ^/api/0\.6/(map|trackpoints|amf|amf/read|swf/trackpoints)$ {
|
||||
include /etc/nginx/fastcgi_params;
|
||||
location ~ ^/api/0\.6/(map|relation|trackpoints|amf|amf/read|swf/trackpoints|trace/[0-9]+/data)$ {
|
||||
fastcgi_pass bulkapi_backend;
|
||||
break;
|
||||
}
|
||||
|
||||
location ~ ^/api/0\.6/.*/search$ {
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_pass bulkapi_backend;
|
||||
break;
|
||||
}
|
||||
|
||||
location ~ ^/api/0\.6/.*/full$ {
|
||||
fastcgi_pass bulkapi_backend;
|
||||
break;
|
||||
}
|
||||
|
||||
# fastcgi Web / Data Browser / Relations etc
|
||||
location ~ ^/api/0\.6/ {
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_pass api_backend;
|
||||
break;
|
||||
}
|
||||
|
||||
#Deny unknown API version
|
||||
location ~ ^/api/0\.[0-9]+/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
#Handle Special Case Expiry
|
||||
location ~ ^/(export|openlayers)/ {
|
||||
expires 7d;
|
||||
}
|
||||
location ~ ^/(images|javascripts|stylesheets)/ {
|
||||
expires max;
|
||||
}
|
||||
|
||||
location / {
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_index index.html;
|
||||
if (!-f $request_filename) {
|
||||
fastcgi_pass web_backend;
|
||||
break;
|
||||
|
@ -169,12 +203,11 @@ http {
|
|||
default_type text/x-cross-domain-policy;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
# redirect server error pages to the static page /50x.html
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /var/www/nginx-default;
|
||||
#error_page 404 /404.html;
|
||||
# redirect server error pages to the static page /50x.html
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /var/www/nginx-default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue