Skip to content

Commit

Permalink
Update Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
njts authored Jan 18, 2023
1 parent 3af5384 commit d3aee62
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,41 @@ You can test it using:
```
curl http://localhost:3000/visitors
```
## Nginx reverse proxy setup with SSL

Install Nginx and certbot on your server:
```
sudo apt-get install nginx && sudo apt install -y nginx certbot python3-certbot-nginx
```
Create a new virtual host configuration file for your api:
```
/etc/nginx/sites-available/tvap
```
Add the following code to the file, replacing your_api.com with your domain name:
```
server {
listen 80;
listen [::]:80;
server_name your_api.com;
location / {
proxy_pass http://localhost:8080/;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
}
}
```
Complete the setup
```
sudo ln -s ../sites-available/tvap /etc/nginx/sites-enabled/tvap
sudo certbot --non-interactive --redirect --agree-tos --nginx -d your_api.com -m your_email@example.com
```
```
sudo nginx -t && sudo systemctl reload nginx
```
> Alternatively, you can use [Cloudflare Tunnel](https://developers.cloudflare.com/tunnel/) for an easier reverse proxy integration.
## Integration examples

### Hugo CMS
Expand Down

0 comments on commit d3aee62

Please sign in to comment.