map $sent_http_content_type $expires {
"text/html" epoch;
"text/html; charset=utf-8" epoch;
default off;
}
server {
listen 80;
access_log /var/log/nginx/access.log;
return 301
https://$host$request_uri;
server_name site; # setup your domain here
root /root/site;
gzip on;
gzip_types text/plain application/xml text/css application/javascript;
gzip_min_length 1000;
location / {
expires $expires;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 1m;
proxy_connect_timeout 1m;
proxy_pass
http://127.0.0.1:3001; # set the adress of the Node.js instance here
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
access_log /var/log/nginx/access.log;
ssl_certificate /etc/ssl/site.crt;
ssl_certificate_key /etc/ssl/site.key; # the port nginx is listening on
server_name site; # setup your domain here
root /root/site;
gzip on;
gzip_types text/plain application/xml text/css application/javascript;
gzip_min_length 1000;
location / {
expires $expires;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 1m;
proxy_connect_timeout 1m;
proxy_pass
http://127.0.0.1:3001; # set the adress of the Node.js instance here
}
}