Windows Server 2012R2 部署Nginx+Tomcat+Mysql架构
架构简介
在Windows Server 2012R2上分别部署用于Windows的Nginx,Tomcat和Mysql版本。Nginx监听80端口,并代理到Tomcat的8080端口。Mysql作为数据库。
部署Nginx
登陆Nginx官网,下载适用于windows操作系统的Nginx版本。
http://nginx.org/en/docs/windows.html
下载到本地windows服务器上后,解压zip包。进入nginx-1.16.1\nginx-1.16.1\conf目录。编辑主配置文件nginx.conf。
在nginx.conf中添加如下配置:
upstream tomcatserver {
server localhost:8080;
}
location / {
# root html;
# index index.html index.htm;
proxy_pass http://tomcatserver;
}
启动nginx:
(1) 方法1: cd C:\Users\Administrator\Desktop\nginx-1.16.1\nginx-1.16.1
nginx.exe