Windows 2012 R2 下的 Nginx 1.16 配置


为了在测试服务器上进行多种开发语言环境的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:

  • install to install the service to Windows Service Controller. This command requires some preliminary steps described in the Installation Guide.
  • uninstall to uninstall the service. The opposite operation of above.
  • start to start the service. The service must have already been installed.
  • stop to stop the service.
  • restart to restart the service. If the service is not currently running, this command acts like start.
  • status to check the current status of the service.
    • This command prints one line to the console.
      • NonExistent indicates the service is not currently installed
      • Started to indicate the service is currently running
      • Stopped to indicate that the service is installed but not currently running.

 

配置启动服务:

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

 

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

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

 

配置虚拟主机:

单个文件反向代理样本:

 

测试环境中注销掉解析:

浏览器访问成功!

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM