nginx shtuff

This commit is contained in:
Kainoa Kanter 2022-03-04 17:28:39 -08:00
parent 3f0a176a84
commit 4235b42cee
2 changed files with 16 additions and 40 deletions

View File

@ -43,7 +43,6 @@ Submit your public instance [here](https://github.com/Domterion/zer0bin/issues/n
- Rust >= 1.58.0
- Postgresql >= 12.0
- Nginx >= 1.18.0
- Tmux
- NodeJS + Yarn (`sudo npm i -g yarn`)
- \*nix OS
@ -56,16 +55,11 @@ Submit your public instance [here](https://github.com/Domterion/zer0bin/issues/n
5. `CREATE DATABSE zer0bin;` and `\c zer0bin`
6. Paste contents of `schema.sql`
7. `\q`
8. `cd backend`
9. `cargo build --release`
10. `cd ../frontend`
11. `yarn && yarn run build`
12. `yarn global add serve`
12. `cd ..`
13. `tmux` (or `tmux a`, `B+c`, `cd` into folder)
14. `cd backend && ./target/release/backend`
15. New tmux pane (`B+"`)
16. `cd frontend && serve ./dist -l 1234`
8. `cd ../frontend`
9. `yarn && yarn run build`
10. `cd backend`
11. `cargo build --release`
14. `./target/release/backend` (preferably in a tmux session)
### Configuration

View File

@ -8,26 +8,17 @@ server {
}
server {
add_header Access-Control-Allow-Origin *;
listen 80;
server_name example.tld www.example.tld;
location / {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://localhost:1234/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
root /location/to/zer0bin/frontend/dist;
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;
@ -35,32 +26,23 @@ server {
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
add_header Access-Control-Allow-Origin *;
listen 443 ssl;
server_name example.tld www.example.tld;
location / {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://localhost:1234/;
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;
root /location/to/zer0bin/frontend/dist;
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;
}