Install and Configure nginx on Windows

Veröffentlicht am: 05 August 2021
auf dem Kanal: i12bretro
4,747
36

#nginx #windows #webserver

Full steps can be found at https://i12bretro.github.io/tutorials...

--------------------------------------------------------------------
Installing and Running nginx
--------------------------------------------------------------------
   01. Download nginx for Windows  http://nginx.org/en/download.html
   02. Extract the downloaded .zip file
   03. Rename the extracted folder nginx
   04. Copy the extracted nginx files to the desired location, for example C:\Program Files\nginx
   05. Open the nginx folder and double click nginx.exe to run the server
 
--------------------------------------------------------------------
Adding PHP Support
--------------------------------------------------------------------
   01. Download Microsoft Visual C++ https://aka.ms/vs/16/release/vc_redis...
   02. Download PHP for Windows (VC15 x64 NTS)  http://windows.php.net/download/
   03. Install Microsoft Visual C++
   04. Extract the downloaded .zip file
   05. Rename the extracted folder php
   06. Copy the extracted php folder to the desired location, for example C:\Program Files\PHP
   07. Open the php install location and right click in the white space while holding down the Shift key ≫ Open PowerShell window here
   08. Paste the following command in the PowerShell window to start the PHP CGI process
         .\php-cgi.exe -b 127.0.0.1:9123
   09. Open Windows Explorer and navigate to the nginx installation directory /conf
   10. Edit nginx.conf in a text editor
   11. Add the following lines inside the server object
         location ~ \.php$ {
             fastcgi_pass   127.0.0.1:9123;
             fastcgi_index  index.php;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             include        fastcgi_params;
         }
   12. Save the changes to nginx.conf
   13. Right click the Start button ≫ Run ≫ Type taskkill /f /im "nginx.exe" ≫ Press Enter
   14. Double click nginx.exe to restart the process with PHP support
 
--------------------------------------------------------------------
Running nginx Server on Startup
--------------------------------------------------------------------
nginx doesn't currently have the ability to run as a Windows service natively. A simple workaround is to create a scheduled task to start the nginx server on system startup
 
   01. Open notepad and paste the following into a blank text file
start "" /b "C:\Program Files\PHP\php-cgi.exe" -b 127.0.0.1:9123
start "" /b "C:\Program Files\nginx\nginx.exe" -c "C:\Program Files\nginx\conf\nginx.conf"
   02. Save the text file as startup.bat in the nginx installation directory
   03. Click the Start button ≫ Search Task ≫ Click Task Scheduler
   04. Right click the Task Scheduler Library folder in the top left ≫ Create Basic Task
   05. Name the task nginx startup ≫ Click Next
   06. Select When the computer starts ≫ Click Next
   07. Select Start a program ≫ Click Next
   08. Click the Browse... button and navigate to C:\Program Files\nginx\startup.bat
   09. Set the Start in value to C:\Program Files\nginx ≫ Click Next
   10. Click Finish
   11. Reboot to test that nginx with PHP support starts with the system on boot
 
Source:  http://nginx.org/en/docs/windows.html
 


Connect with me and others ###
★ Discord:   / discord  
★ Reddit:   / i12bretro  
★ Twitter:   / i12bretro  


Auf dieser Seite können Sie das Online-Video Install and Configure nginx on Windows mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer i12bretro 05 August 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 4,747 Mal angesehen und es wurde von 36 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!