server { listen 80; server_name localhost; root /usr/share/nginx/html; client_max_body_size 500M; server_tokens off; location / { index home.html; error_page 404 404.html; add_header X-Frame-Options "SAMEORIGIN"; if ($request_uri ~ ^/(.*)\.html$) { return 302 /$1?$args; } try_files $uri $uri.html $uri/ =404; } location /oauth { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://localhost:8080/oauth; proxy_redirect off; client_max_body_size 10M; } location /api { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://localhost:8081/api; proxy_redirect off; client_max_body_size 10M; } location /opi { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://localhost:8081/opi; proxy_redirect off; client_max_body_size 10M; } location /kibana { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://localhost:5601/kibana; proxy_redirect off; client_max_body_size 10M; } location /sharedfiles { root /box; } location /articles/id/ { rewrite ^/articles/id/(.+\.js)$ /$1 last; rewrite ^/articles/id/([0-9]+)$ /articles?slug=$1? last; return 200; } location /search/ { rewrite ^/search/(.+\.js)$ /$1 last; rewrite ^/search/(.+)$ /search?keyword=$1? last; } }