-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathnginx.conf
86 lines (72 loc) · 2.54 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
# my-meteor-app/nginx.conf
# ALL SETTINGS ARE NON-HTTPS
# AS WE ARE USING CLOUDFLARE
# TO MANAGE SSL SESSIONS
server {
listen 80;
listen [::]:80;
server_name files.veliov.com;
# STATIC FILES LOCATION
root /var/www/meteor-files-website/public;
# APPLICATION LOCATION
passenger_app_root /var/www/meteor-files-website;
add_header Referrer-Policy origin;
charset utf-8;
default_type text/html;
# IF REQUEST IS SENT TO STATIC FILE
# WHICH DOES NOT EXISTS — FORWARD REQUEST TO NODE.JS
recursive_error_pages on;
error_page 404 = @application;
# SET/DEFINE ENVIRONMENT VARIABLES
# passenger_env_var DEBUG false;
# passenger_env_var ROOT_URL https://files.veliov.com;
# passenger_env_var DDP_DEFAULT_CONNECTION_URL https://files.veliov.com;
# passenger_env_var MONGO_URL mongodb://127.0.0.1:27017/files-veliov-com;
# passenger_env_var METEOR_SETTINGS '{"storagePath":"/data/meteor-files/uploads","public":{"maxFileSizeMb":3000,"maxFilesQty":10,"fileTTLSec":129600,"vapid":{"publicKey":""}},"s3":{"key":"","secret":"","bucket":"","region":""},"vapid":{"email":"","privateKey":""}}';
# AS ALTERNATIVE TO DEFINING ENVIRONMENT VARIABLER IN THIS FILE
# WE PLACE ALL ENVIRONMENT VARIABLES TO secrets.files-veliov-com.conf
include /etc/nginx/secrets.files-veliov-com.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 LEAST 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 Jun 2022 [email protected] required [email protected]
# Get this value by calling (!as appuser):
# nvm which v14.19.3
passenger_nodejs /home/appuser/.nvm/versions/node/v14.19.3/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;
}
}