Created
February 12, 2016 12:02
-
-
Save ianjuma/9b7ed308a2d38be63e97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 4; | |
user www www ; | |
error_log /var/log/nginx/error.log; | |
pid /var/log/nginx/nginx.pid; | |
include /opt/nginx/sites-enabled/*; | |
worker_rlimit_nofile 8192; | |
events { | |
worker_connections 4096; | |
use epoll; | |
} | |
http { | |
index index.html; | |
types_hash_max_size 2048; | |
default_type application/octet-stream; | |
include /etc/nginx/mime.types; | |
sendfile on; | |
tcp_nopush on; | |
server_names_hash_bucket_size 128; | |
## Timeouts | |
client_body_timeout 60; | |
client_header_timeout 60; | |
keepalive_timeout 60 60; | |
send_timeout 60; | |
## Compression | |
gzip on; | |
gzip_buffers 16 8k; | |
gzip_comp_level 4; | |
gzip_min_length 1000; | |
gzip_disable "MSIE [1-6].(?!.*SV1)"; | |
gzip_proxied expired no-cache no-store private auth; | |
gzip_types text/plain text/css text/javascript application/json application/x-javascript application/xml; | |
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 logs/access.log main; | |
server { | |
listen 443; | |
server_name www.autobay.co.ke autobay.co.ke; | |
access_log /var/log/nginx/access.log main; | |
root /var/www/html/static/; | |
## redirect www to nowww | |
if ($host = 'www.autobay.co.ke' ) { | |
rewrite ^/(.*)$ https://autobay.co.ke/$1 permanent; | |
} | |
location / { | |
try_files $uri /index.html; | |
} | |
location /api/ { | |
proxy_pass http://autobay_upstream; | |
} | |
location ~ ^/.+/$ { | |
rewrite .* /index.html last; | |
} | |
ssl_certificate /etc/nginx/ssl/ssl-bundle.crt; | |
ssl_certificate_key /etc/nginx/ssl/server.key; | |
ssl on; | |
location ~* \.(css|js|jpeg|gif|jpg|JPG|png)$ { | |
expires 168h; | |
access_log off; | |
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
} | |
} | |
server { | |
listen 80; | |
server_name www.autobay.co.ke autobay.co.ke; | |
access_log /var/log/nginx/access.log main; | |
rewrite ^/(.*) https://autobay.co.ke/$1 permanent; | |
} | |
# reverse proxy summer | |
upstream autobay_upstream { | |
server {{ local_ip }} weight=1; | |
server 127.0.0.1:8004 weight=5 max_fails=3 fail_timeout=120 down; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment