-
Notifications
You must be signed in to change notification settings - Fork 2
/
nginx.conf
88 lines (73 loc) · 2.18 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# my-meteor-app/nginx.conf
server {
listen 80;
listen [::]:80;
server_name jobs.openweb.dev;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name jobs.openweb.dev;
# TLS CERTIFICATES
ssl_certificate /etc/letsencrypt/live/jobs.openweb.dev/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/jobs.openweb.dev/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
# STATIC FILES LOCATION
root /var/www/near-jobs/public;
# APPLICATION LOCATION
passenger_app_root /var/www/near-jobs;
add_header Referrer-Policy origin;
charset utf-8;
default_type text/html;
# IF REQUEST IS SENT TO STATIC FILE
# WHICHG DOES NOT EXISTS — FORWARD REQUETS TO NODE.JS
recursive_error_pages on;
error_page 404 = @application;
# SET/DEFINE ENVIRONMENT VARIABLES
include /etc/nginx/secrets.near-jobs.conf;
# PASSENGER SETTINGS
passenger_app_type node;
passenger_startup_file main.js;
# SET passenger_sticky_sessions TO `on`
# TO ENABLE "STICKY" SESSIONS ACROSS
# MULTI-SERVER INFRASTRUCTURE
passenger_sticky_sessions off;
# ALWAYS RUN AT LEAT ONE INSTANCE OF THE APP
passenger_min_instances 1;
# path to node.js executable
# This can be changed per server if
# different application with different
# requirement to meteor/node version is
# running on the same sever
#
# As of Oct 2020 [email protected].* required [email protected]
# Get this value by calling (!as appuser):
# nvm which v12.22.1
passenger_nodejs /home/appuser/.nvm/versions/node/v12.22.1/bin/node;
location / {
# CHECK IF REQUEST SENT TO STATIC FILE
# IF NOT FORWARD REQUEST TO NODE.JS
try_files $uri @application;
}
location @application {
# OPTIMIZE HTTP FOR SERVING CODE
proxy_http_version 1.1;
# ENABLE PASSENGER
passenger_enabled on;
break;
}
location /sockjs/ {
# OPTIMIZE HTTP FOR SOCKJS
sendfile off;
proxy_http_version 1.1;
proxy_no_cache 1;
proxy_cache_bypass 1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# ENABLE PASSENGER
passenger_enabled on;
break;
}
}