Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure the environment of Ngnix under Windows

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "how to install and configure Ngnix environment under Windows". Xiaobian shows you the operation process through actual cases. The operation method is simple and fast and practical. I hope this article "how to install and configure Ngnix environment under Windows" can help you solve the problem.

First and foremost, how to install ngnix services in windows?

Download the appropriate version, of course, the recommended use of the mainline version, after downloading, extract and double-click ngnix.exe can run (default port 80), if you have deployed iis on the windows server, be sure to remember to modify the default port, otherwise there will be conflicts.

If everything is OK, visit the local address + port number and you will see an interface like this:

At this time, we can't think that everything is fine, because in the Windows server environment, just running a service in the way of a process will be considered unstable in the first place. Secondly, if the process is recycled or crashed, it is difficult to find relevant logs and error messages, which will bring trouble for debugging. Therefore, we tend to wrap the process as a Windows service, which will have better robustness.

But since ngnix does not support windows services by default (for reasons explained in the introduction, ngnix for windows is only considered a beta release), we'll have to find some other way to install ngnix as a windows service.

Common methods are instsrv/servany, firedaemon, etc., but these methods have their own problems, such as instsrv/servany will generate a new ngnix.exe process when the service restarts, stops/starts. Firedaemon starts with a secondary process by default, and the reasons and background are explained in detail in defonds blog.

So we recommend using windows service wrapper to install ngnix service, which is an open source project on github, he can install any exe, bat and other files as windows service, you can also download his source code on github.

Due to the need to climb the wall and other reasons, not everyone can download the binary version, here is a convenient download. (Version 1.9)

OK, after the download is complete, kill the ngnix process you were running, change winsw.exe to any name and create an xml file as a configuration, of course, the name should be consistent with the exe name.

The configuration codes are as follows:

nginx nginx nginx d:\soft\nginx\nginx-1.9.15\nginx-1.9.15\nginx.exe d:\soft\log\ roll -p d:\soft\nginx\nginx-1.9.15\nginx-1.9.15 -p d:\soft\nginx\nginx-1.9.15\nginx-1.9.15 -s stop

Modify the executable, logpath, startargument, stopargument configurations to suit your needs.

Then cmd to your winsw.exe directory, execute winsw.exe install command (uninstall, please use winsw.exe uninstall).

If everything goes well, you will see your ngnix service appear in the service list, at this time start the service, you can see the welcome message above, then you can consider your ngnix installation successful, and then you can use it.

About "Ngnix in Windows how to install and configure the environment" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the industry information channel. Xiaobian will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report