系統(tǒng)運維 簡介
操作環(huán)境在生產環(huán)境中,很多企業(yè)會經(jīng)常使用nginx + tomcat 架構,nginx作為負載均衡器,反向代理,tomcat作為節(jié)點服務器。在docker容器中也可以使用這種架構。
鄖西網(wǎng)站建設公司創(chuàng)新互聯(lián)公司,鄖西網(wǎng)站設計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為鄖西上千家提供企業(yè)網(wǎng)站建設服務。企業(yè)網(wǎng)站搭建\成都外貿網(wǎng)站建設公司要多少錢,請找那個售后服務好的鄖西做網(wǎng)站的公司定做!
對這種架構感興趣的可以參考博客:https://blog.51cto.com/13760351/2161850
部署過程: 一、安裝nginx鏡像備注:實驗中已關閉防火墻,打好企業(yè)使用的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;
}
四、網(wǎng)頁驗證