为了在测试服务器上进行多种开发语言环境的Web项目演示,采用Nginx这个反向代理服务器。
对外只开放两个端口即可,80和443。
采用域名反向到内部不同的项目中,只要支持HTTP/HTTPS的都可以反向过来。
目前测试过集成IIS、Apache、Tomcat三大流行Web服务器。
在低于Windows 2012的系统下,IIS的443只能一个证书,采用反向代理则可解决这个问题。
官网:
http://nginx.org/en/download.html
Windows版本:
(不建议生产环境中使用,性能比较差。生产还是用Linux比较好,Windows下的Nginx主要用于开发和演示)
http://nginx.org/download/nginx-1.16.0.zip
源码:
http://nginx.org/download/nginx-1.16.0.tar.gz
配置为服务:
https://github.com/kohsuke/winsw/
https://github.com/kohsuke/winsw/releases/tag/winsw-v2.2.0
Your renamed winsw.exe binary also accepts the following commands:
installto install the service to Windows Service Controller. This command requires some preliminary steps described in the Installation Guide.uninstallto uninstall the service. The opposite operation of above.startto start the service. The service must have already been installed.stopto stop the service.restartto restart the service. If the service is not currently running, this command acts likestart.statusto check the current status of the service.- This command prints one line to the console.
NonExistentindicates the service is not currently installedStartedto indicate the service is currently runningStoppedto indicate that the service is installed but not currently running.
- This command prints one line to the console.
配置启动服务:

修改服务名称等相关信息:

采用管理员命令提示符安装服务:

计算机管理服务中可以查看到已经安装好的服务:

配置虚拟主机:

单个文件反向代理样本:

测试环境中注销掉解析:

浏览器访问成功!

