Project release

Server publishing

1.Koa project packaging

  • runnpm run dev
  • Generate package foldersdist

2. Remotely connect to Docker using WebStorm

  • inWebStorminterfacedouble shiftThe inputdocker
  • The pop-updockerService console
  • Click on the+Add the numberdockerservice

  • The service console will display the correspondingdockerservice
  • Double-click to run the service

  • Execute the dockerfile file

  • After the image is packaged, view the image information on the serverdocker images

4. Generate a Docker container and run the server image

  • After successful packaging, generate the Docker container and run the container

    docker run -d –name my_koa -p 5000:5000 my_images

  • Test the server’s interface to see if it works

  • At this point, the server is published successfully
  • Matters needing attention: if used in Nodepath.join(__dirname,myPath)Change the path to absolute when reading filespath.resolve(__dirname,myPath)Otherwise, there will be problems such as cannot read files

React front-end project release

1. Enable the remote transmission permission

  • Install VSFTPDyum install vsftpd
  • useradd ftpadmin -s /sbin/nologin
  • passwd ftpadmin

2. Log in to the remote transmission server using XFTP

3. Create a project root directory, grant permissions, and send front-end compressed packages to the directory

4. Download and install nginx

  • Install nginx

yum -y install gcc pcre-devel zlib-devel openssl openssl-devel

  • Download nginx-9.9.tar. gz and move it to /usr/local/

  • Unpack the nginx

    Unpack the

    The tar – ZXVF nginx – 1.9.9. Tar. Gz

    Go to the nginx directory CD nginx-1.9.9

    configuration

    ./configure –prefix=/usr/local/nginx

    make

    make make install

    CD to the installation directory /usr/loca/nginx/

    ./sbin/nginx -t

  • Start the nginx

    CD /usr/local/nginx/sbin. /nginx/ / Start nginx

5. Configure nginx

server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main root /home/subscription_sys/build; index index.html; location / { try_files $uri $uri/ /index.html; } location/API / {proxy_pass http://127.0.0.1:5000; Proxy_connect_timeout 15000; Proxy_read_timeout 15000; proxy_redirect off; }Copy the code