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 does Docker deploy nginx + tomcat

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

In this issue, the editor will bring you about how to deploy nginx + tomcat in Docker. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Brief introduction

In the production environment, many enterprises often use nginx + tomcat architecture, nginx as the load balancer, reverse proxy, tomcat as the node server. This architecture can also be used in docker containers.

Those who are interested in this architecture can refer to the blog: https://blog.51cto.com/13760351/2161850

Operating environment

Note: the firewall has been turned off and the war package used by the enterprise has been turned off in the experiment.

Deployment process: first, install the nginx image

Please refer to the blog https://blog.51cto.com/13760351/2469063

Deploy the war package project

For the process of deployment and pit removal, please refer to the blog https://blog.51cto.com/13760351/2469305

3. Modify the nginx configuration file

Vim / etc/nginx/nginx.conf

User nginx;worker_processes 1 errorists log / var/log/nginx/error.log warn;pid / var/run/nginx.pid;events {worker_connections 1024;} http {include / etc/nginx/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"$upstream_addr"; access_log / var/log/nginx/access.log main; sendfile on; # tcp_nopush on; keepalive_timeout 65 # gzip on; upstream tomcat {server 47.99.150.153 weight=1; # add weight server 47.99.150.155 weight=1;} server {listen 80; server_name localhost; location / {root / usr/share/nginx/html; index index.html index.htm } location / admin {proxy_pass http://tomcat; # add proxy_redirect off; index index.html index.htm; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-Port $remote_port Proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}} include / etc/nginx/conf.d/*.conf;} IV. Web page verification

The above is the Docker how to deploy nginx + tomcat shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to 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

Servers

Wechat

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

12
Report