浏览代码

Add examples of service & nginx vhost files

theenglishway (time) 4 年之前
父节点
当前提交
fdce9b63d4
共有 3 个文件被更改,包括 41 次插入0 次删除
  1. 26 0
      priv/build/etc/nginx-vhost
  2. 4 0
      priv/build/etc/otp.env
  3. 11 0
      priv/build/etc/otp.service

+ 26 - 0
priv/build/etc/nginx-vhost

@@ -0,0 +1,26 @@
+upstream **otp_backend** {
+  server localhost:**port**;
+}
+
+server {
+  listen 443 ssl;
+  server_name **host_name**;
+
+  index index.html index.htm;
+
+  location / {
+    try_files $uri @backend;
+  }
+
+  location @backend {
+    proxy_pass http://**otp_backend**;
+    proxy_http_version 1.1;
+    proxy_set_header Upgrade $http_upgrade;
+    proxy_set_header Connection 'upgrade';
+    proxy_set_header Host $host;
+    proxy_cache_bypass $http_upgrade;
+  }
+
+  ssl_certificate     /etc/letsencrypt/live/**host_name**/fullchain.pem;
+  ssl_certificate_key /etc/letsencrypt/live/**host_name**/privkey.pem;
+}

+ 4 - 0
priv/build/etc/otp.env

@@ -0,0 +1,4 @@
+SECRET_KEY_BASE={{ secret_key }}
+RELEASE_NAME={{ release_name }}
+RELEASE_VSN={{ release_vsn }}
+PORT={{ port }}

+ 11 - 0
priv/build/etc/otp.service

@@ -0,0 +1,11 @@
+[Unit]
+Description=OTP application {{ otp_app_name }}
+
+[Service]
+User={{ otp_user }}
+WorkingDirectory=/home/{{ otp_user }}/
+EnvironmentFile=/home/{{ otp_user }}/otp.env
+ExecStart={{ otp_executable }} start
+
+[Install]
+WantedBy=multi-user.target