primers

Start Nginx = start Nginx = start Nginx = start Nginx = start Nginx

  • System: Windows 10 Home Chinese Version

  • Version number: 20H2

  • Operating system version: 19042.685

  • Nginx: version 1.18.0, only port and root fields are configured.

  • Origin

  • My GitHub

The solution

Windows can manually modify the registry to set the boot option, feel a little cumbersome, or find a tool. Find the tool WinSW, which wraps any application and manages it as a Windows service. You can download the compiled executable file here. The version used this time is WinSW V3.0.0-alpha.7.

WinSW is used as a global tool:

  1. downloadWinSW.exeWinSW.zip
  2. newmyapp.xml(See for more detailsThe documentandThe sample).
  3. runwinsw install myapp.xml [options]Installation services.
  4. runwinsw start myapp.xmlEnable the service.
  5. runwinsw status myapp.xmlCheck that the service is up and running.

Other points of attention were found in the actual operation:

  • Parameter when entering a commandmyapp.xmlNot required. If you want to omit it, let the profile name followWinSW.exeThe file name must be the same. Otherwise, an error occurs if the configuration file name is not included.
  • WinSW.exeThe file must be placed in the nginx installation directory; otherwise, the command will prompt you that the nginx configuration file cannot be found.
  • When an error occurs, logs are generated to help troubleshoot the fault.

The following is an example of a personal configuration step.

Step 1

Move the downloaded exe file to the nginx directory, rename it to winsw.exe, create a new configuration file winsw. XML, and write the following configuration:

<service> <id>nginx service</id> <name>Nginx</name> <description>This service runs Nginx.</description> <env Name ="NGINX_COMIC" value="%BASE%" /> <prestart>start D:\nginx-1.18.0\nginx.exe</prestart> <executable>D:\nginx-1.18.0\nginx.exe</executable> <prestop>D:\nginx-1.18.0\nginx.exe -s stop</prestop> <log mode="roll"  /> <onfailure action="none" /> </service>Copy the code

Step 2

Open the cli in the current directory (enter CMD in the current directory) and run the following command:

winsw install
Copy the code

Success will result in the following prompt:

To check whether the service is successfully added, right-click this computer and choose Manage > Services and Applications > Services:

Step 3

Check whether the startup service is normal:

winsw start
Copy the code

A message is displayed indicating successful startup. Access the nginx configured address to verify that it is valid. After confirming, restart the computer to see if it will boot itself.

The resources

I looked at the strange Journey of the Soul. It was well made. What impressed me most was the words of the protagonist after he realized his life dream:

You can obviously feel the sense of difference. Back at home, thinking about all the normal things and things in life, and 22’s reaction to these things as normal and taken for granted, decided to let 22 back into the world.

What this story makes me understand is that, no matter the dream is realized or not, ordinary things and things actually take up a large part for most of us, which should be worth cherishing.

So why would he want to let 22 into the world at the cost of his own life? Couldn’t say for sure.