[chore] add nginx and systemd config
This commit is contained in:
parent
cce9975bf1
commit
7ff165fdb4
2 changed files with 53 additions and 0 deletions
14
dist/liberty-hu.service
vendored
Normal file
14
dist/liberty-hu.service
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#See https://computingforgeeks.com/how-to-run-java-jar-application-with-systemd-on-linux/
|
||||||
|
[Unit]
|
||||||
|
Description=Liberty Hu service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
WorkingDirectory=/opt/prod
|
||||||
|
ExecStart=/bin/java -Xms256m -Xmx512m -jar liberty-hu.jar
|
||||||
|
User=jvmapps
|
||||||
|
Type=simple
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=10
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
39
dist/nginx.conf
vendored
Normal file
39
dist/nginx.conf
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=24h max_size=1g;
|
||||||
|
|
||||||
|
server {
|
||||||
|
server_name {SERVER};
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:3000;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_buffering on;
|
||||||
|
proxy_cache STATIC;
|
||||||
|
proxy_cache_valid 200 1d;
|
||||||
|
add_header X-Cached $upstream_cache_status;
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /robots.txt {
|
||||||
|
add_header Content-Type text/plain;
|
||||||
|
return 200 "User-agent: *\nDisallow: /\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
listen 443 ssl; # managed by Certbot
|
||||||
|
ssl_certificate /etc/letsencrypt/live/{SERVER}/fullchain.pem; # managed by Certbot
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/{SERVER}/privkey.pem; # managed by Certbot
|
||||||
|
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||||
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name {SERVER};
|
||||||
|
|
||||||
|
if ($host = {SERVER}) {
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
} # managed by Certbot
|
||||||
|
}
|
Loading…
Reference in a new issue