Created Server setup (markdown)
111
Server-setup.md
Normal file
111
Server-setup.md
Normal file
@@ -0,0 +1,111 @@
|
||||
# Running express as systemd service
|
||||
|
||||
This expects vinlottis project folder at `/opt/vinlottis`
|
||||
```
|
||||
[Unit]
|
||||
Description=Vinlottis vue application
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/vinlottis
|
||||
ExecStart=/usr/bin/yarn start
|
||||
ExecStartPre=/usr/bin/docker start mongodb
|
||||
Restart=always
|
||||
# Restart service after 10 seconds if node service crashes
|
||||
RestartSec=10
|
||||
# Output to syslog
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=vinlottis
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
|
||||
## nginx
|
||||
|
||||
```
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name lottis.vin;
|
||||
|
||||
gzip on;
|
||||
gzip_types application/javascript;
|
||||
gzip_min_length 1000;
|
||||
|
||||
location / {
|
||||
proxy_http_version 1.1;
|
||||
add_header 'Access-Control-Allow-Origin' 'lottis.vin';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'Content-Type, vinlottis-admin';
|
||||
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
resolver 10.0.0.72;
|
||||
proxy_pass http://10.0.0.52:30030;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/lottis.vin-0001/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/lottis.vin-0001/privkey.pem; # managed by Certbot
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name knowit.vin;
|
||||
|
||||
gzip on;
|
||||
gzip_types application/javascript;
|
||||
gzip_min_length 1000;
|
||||
gzip_static on;
|
||||
|
||||
|
||||
location / {
|
||||
proxy_http_version 1.1;
|
||||
add_header 'Access-Control-Allow-Origin' 'knowit.vin';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'Content-Type';
|
||||
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
resolver 10.0.0.72;
|
||||
proxy_pass http://10.0.0.52:30030;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/knowit.vin-0001/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/knowit.vin-0001/privkey.pem; # managed by Certbot
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name vinlottis.no;
|
||||
|
||||
gzip on;
|
||||
gzip_types application/javascript;
|
||||
gzip_min_length 1000;
|
||||
|
||||
|
||||
location / {
|
||||
proxy_http_version 1.1;
|
||||
add_header 'Access-Control-Allow-Origin' 'vinlottis.no';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'Content-Type';
|
||||
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
resolver 10.0.0.72;
|
||||
proxy_pass http://10.0.0.52:30030;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/vinlottis.no-0003/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/vinlottis.no-0003/privkey.pem; # managed by Certbot
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user