Skip to main content

APP Server

Server Prerequisite

  • Operating System: ubuntu 22.04 (LTS).

  • Instance Type: t2. Medium

  • Port Required: 80 (http), 22 (SSH)

App Server Setup

  • Install nginx proxy server

>> sudo apt-get update

>> sudo apt-get install nginx

Nginx Configure file

  • Update nginx.conf file:

>> sudo vim /etc/nginx/conf.d/proconf.conf

This is sample nginx configuration

            ```
server {

root /var/www/html/admin;

index index.html index.htm index.nginx-debian.html;

server_name admin.proconf.live;

location / {

try_files \$uri /index.html;

}

location /api {

etag on;

add_header Cache-Control "private,max-age=2592000";

proxy_set_header X-Real-IP \$remote_addr;

proxy_set_header X-Forwarded-For \$remote_addr;

proxy_set_header Host \$host;

proxy_pass http://127.0.0.1:5000;

}

listen \[::\]:443 ssl ipv6only=on; \# managed by Certbot

listen 443 ssl; \# managed by Certbot

ssl_certificate /etc/letsencrypt/live/admin.proconf.live/fullchain.pem;
\# managed by Certbot

ssl_certificate_key
/etc/letsencrypt/live/admin.proconf.live/privkey.pem; \# managed by
Certbot

include /etc/letsencrypt/options-ssl-nginx.conf; \# managed by Certbot

ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; \# managed by Certbot

}

server {

if (\$host = admin.proconf.live) {

return 301 https://\$host\$request_uri;

} \# managed by Certbot

listen 80;

listen \[::\]:80;

server_name admin.proconf.live;

return 404; \# managed by Certbot

}
```

Commands to manage Nginx Server

  • Check nginx configuration

>> sudo nginx -t

  • Stop nginx

>> sudo service nginx stop

  • Start nginx

>> sudo service nginx start

  • Check nginx status

>> sudo service nginx status

  • Restart nginx:

>> sudo service nginx restart

System configuration for Nginx

  • Run below commands to restart nginx on system reboot

>> sudo systemctl enable nginx

>> sudo update-rc.d nginx defaults

Check Nginx logs

  • Nginx logs are available under directory /var/log/nginx.

  • Access log files are named as access.log.

  • Error log files are named as error.log.

App Server UI Deployment

  • Take Build from Developer for UI In the form of zip.

  • Move Zip folder to newbuild Directory with the help of FileZilla.

  • Take Backup of Old Build and Remove old build under /var/www/html/admin

  • Extract the admin.zip under the /var/www/html/

Note: Please create zip with the name admin and after extracting it will create a folder with name admin.

Backend Server Deployment

  • Take Build from Developer for Backend proconf-admin-dev.zip

  • Move Zip folder to backend Directory with the help of FileZilla.

  • Pm2 stop 0 and Take Backup of Old Build and Remove old build.

  • Extract the proconf-admin-dev.zip under the ~/backend folder.

  • Pm2 flush 0 and pm2 start 0