当前位置:网站首页>Web Application & applet application deployment

Web Application & applet application deployment

2022-06-13 01:09:00 includeSteven

Web application & Applet application deployment

Because the server and domain name are about to expire , And the renewal fee is too expensive , So consider buying servers and domain names again ( Take advantage of the fact that the double 11 activity server is very cheap ), Here is a record of the server application deployment 、HTTPS Settings and applet related configuration changes , In addition, all installations here are carried out through the pagoda panel , The installation process will not be repeated .

notes : The following {} Surrounded by the contents or parameter values that need to be filled in by the reader according to the actual situation

Web Application deployment

The overall application is developed by separating the front and rear ends , Therefore, you need to start the front end and the back end respectively , The front end uses Nginx Reverse proxy and static resource forwarding , Back end adoption SpringBoot Framework development .

Web Application backend application startup

1. install jdk8.0 Environmental Science

  • download jdk Installation package :

Download from official website jdk Installation package , The official website address is :https://www.oracle.com/java/technologies/downloads/#java8, The official website needs Oracle account number , Here you can search for the shared on Baidu Oracle account number , From the results, find some with a new publication date

  • decompression jdk Installation package , The order is :tar -C /usr/local -zxvf {jdk file name }

  • Set the environment variable , Need modification /etc/profile file , The specific configuration is as follows ( stay /etc/profile Add the following information to the file )

# Java Evn
export JAVA_HOME=/usr/local/jdk1.8.0
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
  • Make the environment variable settings take effect immediately , The order is :source /etc/profile
  • See if the environment variable works , Using the command to return the correct version information indicates success :java -version

2. install MySQL database

Here we use the pagoda panel to install MySQL database , Create a new database in the database options , The database name 、 The username and password need to be the same as Web The configuration in the application is the same

3. install Redis database

Because this project needs to use Redis Cache database , Therefore, the pagoda panel installation is used here Redis database

4. start-up SpringBoot project

This system consists of springboot Development , So the packaged application is a jar package , It's easy to deploy , Just start the service , Here, the startup command is set as a script , as follows :

rm -rf nohup.out #  Use nohup The deployment redirects the standard output to nohup.out, Of course, you can redirect the output to /dev/null, Because the author sometimes wants to view the contents of the file , So use the default redirect file directly 
nohup java -jar {
    jar Package file name } &

notes : The open port of the back-end service here is 8080, No need to open to the public network , Subsequent requests will pass Nginx Reverse proxy to local 8080 port

Web Application front end configuration ( use HTTPS agreement )

Nginx The installation of is not described here , If the reader needs to deploy the application to the server , Pagoda panel management can be used Linux The server , install Nginx And other software will be very convenient .

Because it is installed in the pagoda Nginx Of nginx.conf It contains /www/server/panel/vhost/nginx/*.conf Configuration in , Therefore, the following configurations can be copied to this directory

Nginx The configuration is as follows :

server {
    listen 443 ssl;
    #  Define access domain names 
    server_name  { domain name };
    #  Certificate file name 
    ssl_certificate      {target_pem_path};
    #  Key file name 
    ssl_certificate_key  {target_key_path};
        

    #ssl_session_cache    shared:SSL:1m;
    ssl_session_timeout  5m;

    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers  ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_prefer_server_ciphers  on;
        
    #  Define access domain names 
    location / {
        root   { Site directory }
        try_files $uri $uri/ /index.html;
        index  index.html;
    }
    
    #  Here will be all /prod-api The initial connections are all reverse proxied to the local 8080 port 
    location /prod-api/{
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:8080/;
    }
 
    location /profile/ {
        proxy_pass http://localhost:8080/profile/; 
    }
    access_log  { Access log path };
    error_log  { Failure log path };
}

Note the need for SSL certificate , Alibaba cloud's free... Is used here ssl certificate , Links are as follows :https://yundun.console.aliyun.com/?spm=5176.12818093.ProductAndService--ali--widget-home-product-recent.dre1.5adc16d0Sa02kH&p=cas#/certExtend/free, You can apply.

Applet application deployment

Why deployment is required HTTPS agreement , This is because the third-party services on the applet side must adopt HTTPS agreement , Here, you need to fill the deployed domain name into the trusted list on the applet side , Then modify the applet side baseUrl, Just review .

原网站

版权声明
本文为[includeSteven]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280555542560.html