Skip to content

Instantly share code, notes, and snippets.

@aregee
Created January 11, 2016 14:09
Show Gist options
  • Save aregee/f9d4f3e82181b353d038 to your computer and use it in GitHub Desktop.
Save aregee/f9d4f3e82181b353d038 to your computer and use it in GitHub Desktop.
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $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;
#keepalive_timeout 0;
keepalive_timeout 65;
types_hash_max_size 2048;
gzip on;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
index index.html index.htm;
server {
listen 80;
server_name localhost;
large_client_header_buffers 4 32k;
location /api {
rewrite /api(.*) /$1 break;
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header Host $host;
}
location / {
proxy_set_header Host 'bucket.s3-website-us-west-2.amazonaws.com';
proxy_set_header Authorization '';
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
proxy_hide_header Set-Cookie;
proxy_ignore_headers "Set-Cookie";
proxy_intercept_errors on;
proxy_pass http://bucket.s3-website-us-west-2.amazonaws.com;
expires 1y;
log_not_found off;
}
location ~/dist/ {
rewrite ^/dist/(.*)$ http://bucket.s3-website-us-west-2.amazonaws.com/dist/$1 redirect;
}
location ~/public/ {
rewrite ^/public/(.*)$ http://bucket.s3-website-us-west-2.amazonaws.com/public/$1 redirect;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment