Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How the server uses Nginx to deploy Springboot projects

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "how the server uses Nginx to deploy the Springboot project", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how the server uses Nginx to deploy Springboot projects" article.

1. Package the java project into jar package

What I use here is the maven tool.

Here are two projects, one for demo.jar and the other for jst.jar

two。 Prepare the tool

1. Server

two。 Domain name (Note: for the record)

3.xshell is used to connect to the server

4.winscp (Note: view tool for transferring jar)

3. Pass the jar package to the server

Just drag directly.

3. Run the jar package using xshell

Note: (server java environment and maven environment, please configure yourself, do not describe here. )

Execute under the path from cd to jar package: nohup java-jar demo.jar > temp.txt &

Use ip and port number access interface after starting two jar packages

(note: test interface)

4. Download and install nginx

5. Configure nginx.conf

* * (Note: * represents server address)

Http {include mime.types; default_type application/octet-stream; # log_format main'$remote_addr-$remote_user [$time_local] "$request"'#'$status $body_bytes_sent "$http_referer"#"$http_user_agent"$http_x_forwarded_for"; # access_log logs/access.log main; sendfile on; # tcp_nopush on; # keepalive_timeout 0; keepalive_timeout 65; # gzip on Server {# listening port number listen 80; # set the secondary domain name server_name demo.eysource.com; # charset koi8-r; # access_log logs/host.access.log main; location / {# configure the project path for access (note: focus here) proxy_pass http:*:9091/ # root html; # index index.html index.htm; proxy_set_header host $host Proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; client_max_body_size 100m; root html; index index.html index.htm;}} server {# listening port number listen 80; # set the secondary domain name server_name aaa.eysource.com; # charset koi8-r; # access_log logs/host.access.log main for access Location / {# configure the project path to be accessed (Note: focus here) proxy_pass http:*:8080/ # root html; # index index.html index.htm; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; client_max_body_size 100m; root html; index index.html index.htm;}

6 access through domain name (successful)

The above is about the content of this article on "how to deploy the Springboot project with Nginx on the server". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report