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.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.1 Setup and Run TyraWeb NodeJS/Express API.
You can follow up this tutorial.
- 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/
If you find this project usefull for your professional life, consider making a donation.