使用Nginx代理Tomcat服务器

windows下的nginx代理
下载nginx
解压就可以使用
在解压当前目录启动

以下是nginx.conf的配置
D:\nginx-1.16.1\conf

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       8081; #nginx服务器端口
        server_name  localhost;

        location / {
			proxy_pass  http://localhost:80;
			# proxy_pass 转发路径forward to tamcat
            root   html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
   
    }
}

无需重启加载nginx.conf

让nginx代理tomcat。这个我们使用8081端口为nginx的启动,端口未代理的时候,此时tomcat要启动


我们开启nginx之后

推荐博文 https://www.cnblogs.com/taiyonghai/p/9402734.html#4340261

全部评论

相关推荐

点赞 评论 收藏
分享
06-05 19:46
已编辑
武汉大学 后端
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务