Readme instructions, sample nginx

This commit is contained in:
Kainoa Kanter 2022-02-28 16:17:29 -08:00
parent 726b787ea0
commit 70f976c4e9
2 changed files with 69 additions and 0 deletions

View File

@ -16,3 +16,25 @@
# License
MIT
# Instructions
### Requirements
- Rust >= 1.58.0
- Postgresql >= 12.0
- Nginx >= 1.18.0
1. `git clone https://github.com/Domterion/zer0bin && cd zer0bin`
2. `cp config.example.json config.json` and edit as appropriate
3. `cp example.nginx /etc/nginx/sites-avaliable/yoursite.tld`, edit as appropriate, `sudo cp /etc/nginx/sites-avaliable/yoursite.tld /etc/nginx/sites-enabled/yoursite.tld && systemctl nginx restart`
4. `psql -d postgres`
5.
```
CREATE DATABSE zer0bin;
\c zer0bin
```
6. Paste contents of `schema.sql`
7. `\q`
8. `cd backend`
9. `cargo build --release`
10. `./target/release/backend`

47
example.nginx Normal file
View File

@ -0,0 +1,47 @@
# replace example.tld with your domain
server {
#listen 80 is default
server_name www.example.tld;
return 301 $scheme://example.tld$request_uri;
}
server {
add_header Access-Control-Allow-Origin *;
listen 80;
server_name example.tld www.example.tld;
root /home/the1calc/zer0bin/frontend;
index index.html;
location ^~ /.well-known/ {
alias /var/www/.well-known/;
}
location /api/ {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://localhost:8000/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
server {
add_header Access-Control-Allow-Origin *;
listen 443 ssl;
server_name example.tld www.example.tld;
root /home/the1calc/zer0bin/frontend;
index index.html;
location ^~ /.well-known/ {
alias /var/www/.well-known/;
}
location /api/ {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://localhost:8000/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
#ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
}