百度智能云

All Product Document

          Cloud Compute Service

          Nginx Environment of Windows Installation and Configuration

          1. Close the IE enhanced security mode

          As windows server enables IE enhancement model in its IE explorer by default, to make it easy to download resources and do testing later on, this feature is closed. For detailed operating steps, see the documentation: https://cloud.baidu.com/doc/BCC/s/pjxlpzqce Once closed, the IE explorer is available to use. You can choose to download other browsers, for example, use Chrome as indicated in the following steps.

          1. Download nginx

          Go to the nginx official download address:http://nginx.org/en/download.html to download a stable release, as shown in the figure, such as nginx/Windows-1.18.0.

          image2020-5-13_16-9-4.png

          Download and decompress the file, you will then get the following files:

          image2020-5-13_15-47-26.png

          1. Have nginx installed and start it

          Double click nginx.exe, after which, a Black prompt flashes out. Alternatively, open CMD command Line and move to a nginx decompressed directory. Issue the command nginx.exe or start nginx, type Enter; because it is cubersome to manually start or stop nginx using command, in addition making it hard to do maintenance later on, you can add nginx to the Windows Services list. For details, see Step 4.

          1. Add nginx to Windows services

          Download Wrapper services: http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/ . This tool allows you to set nginx as a windows service. Choose a suitable version, which version 2.7.0-bin is the best fit. A download page is shown as follows:

          image2020-5-13_18-5-38.png

          image2020-5-13_18-5-59.png

          Put the downloaded winsw-2.7.0-bin.exe file under the nginx installation directory( it is here:C:\nginx-1.18.0\), change its name to :nginx-service.exe , before creating nginx-service.exe.config,nginx-service.xml files,then putting them under the Nginx installation directory, as shown in the figure:

          image2020-5-13_18-8-21.png

          Note that windows2012 hides suffix of a file by default. Once you have created a text file, its suffix .txt remains. you'd better click "view”on the upper side of the directory, check the file extension name. when you renaming it, remove the suffix . Txt.

          image2020-5-13_18-36-30.png

          Content of nginx-service.exe.config is as follows:

          image.png

          Content of nginx-service.xml is as follows:

          image.png

          (In the Nginx-service.xml file, replace C:\nginx-1.18.0\with your installed nginx directory)

          1. Install NET4 plus environment

          The winsw program can be up and running under NET environment, by default, NET 4.5 is available on the Windows 2012,so you can skip this step.

          1. Execute winsw, before adding nginx services.

          Enter cmd command Line mode or click the task bar to enter powershell command Line. Then, enter the nginx installation directory, “cd C:\nginx-1.18.0”,issue the command “nginx-service.exe install” to start the installation program as shown in the figure:

          image.png

          image.png

          1. Start and access the Nginx.

          With a right click of mouse button, enter the nginx service,you can view the options to start, select the Start , nginx services will automatically start with its status changing to Running. Open a web browser and access http://locahost . You can see the default page of nginx, indicating the deployment is complete.

          image.png

          1. Start inbound rules for advanced firewall from within a server.

          Windows server enables advanced firewall by default. Once a service is up and running, you need to open a corresponding port or shut down firewall in inbound rules of the firewall. For information on shutting down firewall,see the documentation:https://cloud.baidu.com/doc/BCC/s/bjxlq3hzn

          Previous
          BCC Deployment SSL Certificate
          Next
          API Reference