$ npm run build
This will generate a /build
directory, upload this directory to your server using scp
Secure Copy or something else.
$ scp -r build root@11.222.3.444:/var/www/my-app.mydomain.com
More details on this link
$ cd /etc/nginx/sites-available
$ touch my-app.mydomain.com.conf
Edit NginX configuration my-app.mydomain.com.conf
$ nano my-app.mydomain.com.conf
Put the following values
server {
server_name my-app.mydomain.com;
listen 80;
index index.html;
root /var/www/my-app.mydomain.com;
location / {
try_files $uri$args $uri$args/ /index.html;
}
# Re-route the request
location /api {
proxy_pass http://api.my-app.mydomain.com;
}
access_log /var/log/nginx/my-app.mydomain.com_access.log;
error_log /var/log/nginx/my-app.mydomain.com_error.log;
}
$ ln -s /etc/nginx/sites-available/my-app.mydomain.com.conf /etc/nginx/sites-enabled/my-app.mydomain.com.conf
$ nginx -t && service nginx restart
$ certbot --nginx