Idea deploys SpringBoot multi-module service (jetty)

        Find the module that needs to be deployed. For example, A is the main module and B is the newly written module. Click maven on the right of idea, find the B module, and double-click the package to complete the package.

        The SpringBoot project needs a started main, and the maven plug-in can be added to the pom file of the main entry

 <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

        Upload the jar package to the folder specified by linux. If you use the command java -jar xxxx.jar to deploy, it cannot run in the background. Use the command nohup java -jar xxxx.jar &, and the & symbol must not be forgotten.

        After the test passes, you can modify the tengine configuration, find the location of tengine, command find -name tengine, enter the tengine directory, find the conf directory, enter, and edit nginx.conf with vi.

        Find the server node in nginx.conf and add configuration in it. For example, the access address of the newly deployed project is xxx.xx.xx.xxx:8080/test/.......

server{
    listen        80;
    server_name   xx.xxx.xx.xxx(本机地址)
    
    location /test/ {
        proxy_pass http://localhost(具体看部署的服务的ip地址):8080
    }
}

        When restarting tengine, if an error is reported, as follows:

Redirecting to /bin/systemctl restart nginx.service

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

        Many times it is because the listen port is occupied. For example, if I configure 80 here, then I turn off the occupied port 80, command:

sudo fuser -k 80/tcp

        Then go to the sbin directory of tengine to start tengine, command:

service nginx start(启动)(stop停止,reload重启)

        The last access to the configured 80 is successful.

Guess you like

Origin blog.csdn.net/qq_41061437/article/details/111041896