100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > nginx+tomcat 反向代理 负载均衡配置

nginx+tomcat 反向代理 负载均衡配置

时间:2023-04-06 00:57:14

相关推荐

nginx+tomcat 反向代理 负载均衡配置

1、nginx的安装和配置见:/ll409546297/p/6795362.html

2、tomcat部署项目到对应的服务器上面并启动,不详解

3、在nginx中配置nginx.conf文件:

user nobody; worker_processes 4;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024;}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_nopushon;#keepalive_timeout 0;# '"$http_user_agent" "$http_x_forwarded_for"';#access_log logs/access.log main;sendfile on;#tcp_nopushon;#keepalive_timeout 0;keepalive_timeout 65;#gzip on;upstream tomcat_client { #针对于8080端口实现ip_hash;server localhost:8080; #如果存在多个部署,写入地址和端口即可}server {listen 80;server_name localhost; #本地访问名称可以修改,针对于外网可以写成域名#charset koi8-r;#access_log logs/host.access.log main;location / {proxy_pass http://tomcat_client; proxy_redirect default;#设置代理proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;}

4、启动nginx就可以访问自己的项目

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。