Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

TyraVet/production-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

License Buy Me A Coffee donate button

TyraWeb Production Guide

VueJS app and NodeJS/Express API in same machine.

We're goint to use Nginx to serve our software into the world. We decided to go with Nginx because it can be used as a reverse proxy. In this way we have our static website and also the API on another port in the same machine. So before anything install Nginx in your system.

1. Set your static website files

  • 1.1 Setup and Build TyraWeb VueJS Application.
  • 1.2 Create directory /var/www/yourdomain.com.
  • 1.3 Move the static website files from the build into that folder.

2. Set API

3. Create SSL Certificate

You can follow up this tutorial.

4. Config Nginx

  • 4.1 Create /etc/nginx/sties-available/yourdomain.com
server {
    listen 443 default_server;
    listen [::]:443 default_server;
    
    ssl on;
    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
    
    root /var/www/yourdomain.com;
    index index.html;
    
    location / {
        try_files $uri $uri/ = 404;
    }
    
    location /api {
        proxy_http_version 1.1;
        proxy_cache_bypass $http_upgrade;
        
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $stream_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        
        proxy_pass http://localhost:3000;
    }
}

server {
    listen 80;
    server_name yourdomain.com;
    rewrite ^ https://$host$request_uri? permanent;
}
  • 4.2 Create symbolic link in the ./sites-enabled directory.
ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/

Contributing

If you find this project usefull for your professional life, consider making a donation.

License

MIT