parent
d8881d430c
commit
c0966e74a0
@ -53,42 +53,54 @@ server {
|
|||||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
server {
|
server {
|
||||||
if ($host = chat.example.com) {
|
if ($host = chat.example.com) {
|
||||||
return 301 https://$host$request_uri;
|
return 301 https://$host$request_uri;
|
||||||
} # managed by Certbot
|
} # managed by Certbot
|
||||||
|
|
||||||
|
|
||||||
if ($host = www.chat.example.com) {
|
if ($host = www.chat.example.com) {
|
||||||
return 301 https://$host$request_uri;
|
return 301 https://$host$request_uri;
|
||||||
} # managed by Certbot
|
} # managed by Certbot
|
||||||
|
|
||||||
|
|
||||||
listen 80 ;
|
listen 80 ;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
server_name chat.example.com;
|
server_name chat.example.com;
|
||||||
return 404; # managed by Certbot
|
return 404; # managed by Certbot
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
Place the file in ```bash /etc/nginx/sites-available/``` (depending on your linux distro this may differ).
|
|
||||||
|
Place the file in
|
||||||
|
```bash
|
||||||
|
/etc/nginx/sites-available/
|
||||||
|
|
||||||
|
```
|
||||||
|
(depending on your linux distro this may differ).
|
||||||
|
|
||||||
Now make a symlink -
|
Now make a symlink -
|
||||||
|
|
||||||
```bash sudo ln -s /etc/nginx/sites-available/chatto /nginx/sites-enabled```
|
```bash
|
||||||
|
sudo ln -s /etc/nginx/sites-available/chatto /nginx/sites-enabled
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
verify configration -
|
verify configration -
|
||||||
```bash sudo nginx -t```
|
```bash
|
||||||
|
sudo nginx -t
|
||||||
|
```
|
||||||
and restart nginx -
|
and restart nginx -
|
||||||
```bash sudo systemctl restart nginx```
|
```bash
|
||||||
|
sudo systemctl restart nginx
|
||||||
|
```
|
||||||
|
|
||||||
Now create a linux user -
|
Now create a linux user -
|
||||||
```bash sudo useradd -r -s /bin/false```
|
```bash
|
||||||
|
sudo useradd -r -s /bin/false
|
||||||
|
```
|
||||||
|
|
||||||
Next create a systemd script making use of the created user-
|
Next create a systemd script making use of the created user-
|
||||||
|
|
||||||
```
|
```
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=System Daemon for Chatto
|
Description=System Daemon for Chatto
|
||||||
@ -104,12 +116,36 @@ RestartSec=10
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
```
|
```
|
||||||
|
|
||||||
Take note of the spring profiles argument. It enabled the production profile. Omitting it would run the app in dev profile.
|
Take note of the spring profiles argument. It enabled the production profile. Omitting it would run the app in dev profile.
|
||||||
|
|
||||||
Name the file chatto.service and place it in ```/etc/systemd/systemd```.
|
Name the file chatto.service and place it in
|
||||||
|
|
||||||
Reload systemd daemon - ```bash sudo systemctl daemon-reload```
|
```
|
||||||
Then start the service - ```bash sudo systemctl start chatto```
|
/etc/systemd/systemd
|
||||||
|
|
||||||
|
```
|
||||||
|
Reload systemd daemon -
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
```
|
||||||
|
|
||||||
|
Then start the service -
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
sudo systemctl start chatto
|
||||||
|
```
|
||||||
|
|
||||||
If everything went well then the app should start.
|
If everything went well then the app should start.
|
||||||
Check with ```bash sudo systemctl status chatto``` and if it fails to start do ```sudo journalctl -u chatto``` to check the cause of the failure.
|
Check with
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
sudo systemctl status chatto
|
||||||
|
```
|
||||||
|
and if it fails to start do
|
||||||
|
```
|
||||||
|
sudo journalctl -u chatto
|
||||||
|
```
|
||||||
|
to check the cause of the failure.
|
||||||
|
If everything went well then the app should start.
|
||||||
|
Loading…
Reference in New Issue
Block a user