系統運維 簡介
操作環境在生產環境中,很多企業會經常使用nginx + tomcat 架構,nginx作為負載均衡器,反向代理,tomcat作為節點服務器。在docker容器中也可以使用這種架構。
對這種架構感興趣的可以參考博客:https://blog.51cto.com/13760351/2161850鄖西網站建設公司創新互聯公司,鄖西網站設計制作,有大型網站制作公司豐富經驗。已為鄖西上千家提供企業網站建設服務。企業網站搭建\成都外貿網站建設公司要多少錢,請找那個售后服務好的鄖西做網站的公司定做!
部署過程: 一、安裝nginx鏡像備注:實驗中已關閉防火墻,打好企業使用的war包
二、部署war包項目可參考博客 https://blog.51cto.com/13760351/2469063
三、修改nginx配置文件部署及排坑過程可參考博客 https://blog.51cto.com/13760351/2469305
vim /etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_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:8088 weight=1; #添加權重
server 47.99.150.155:8088 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; #添加
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;
}
四、網頁驗證
新聞名稱:Docker部署nginx+tomcat
文章出自:http://www.yijiale78.com/article48/cpcdep.html
成都網站建設公司_創新互聯,為您提供微信公眾號、用戶體驗、虛擬主機、建站公司、網站營銷、商城網站
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯