User Tools

Site Tools


servers:windows:nginx_php_php-cgi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
servers:windows:nginx_php_php-cgi [2026/01/17 09:20] – [HTTPS Redirect] Sean Rhoneservers:windows:nginx_php_php-cgi [2026/02/25 05:51] (current) – [nginx] Sean Rhone
Line 4: Line 4:
   * PHP ((https://windows.php.net/download/))   * PHP ((https://windows.php.net/download/))
   * PHP-CGI   * PHP-CGI
-  * [[Information:Realm of Espionage]]+  * [[information;realm_of_espionage|Realm of Espionage]]
  
 ===== Prerequisites ===== ===== Prerequisites =====
Line 14: Line 14:
 ===== nginx ===== ===== nginx =====
  
-  * https://nginx.org/en/download.html +  * https://nginx.org/en/download.html ([[https://nginx.org/en/CHANGES|CHANGES]]) 
-  * Last tested: ''nginx-1.29.4.zip''+  * Last tested: ''nginx-1.29.5.zip''
  
-  * Extract to root system drive for ''C:\nginx-1.29.4\nginx.exe''+  * Extract to root system drive for ''C:\nginx-1.29.5\nginx.exe''
  
   "explorer.exe" "%SystemDrive%"   "explorer.exe" "%SystemDrive%"
- 
-==== Information ==== 
- 
-  CD "%SystemDrive%\nginx-"*"\" && "nginx.exe" -v 
- 
-  CD "%SystemDrive%\nginx-"*"\" && "nginx.exe" -c "%SystemDrive%\www\nginx\nginx.conf" -t 
  
 ===== PHP-CGI ===== ===== PHP-CGI =====
  
-  * https://windows.php.net/download/ +  * https://windows.php.net/download/ ([[https://windows.php.net/downloads/releases/|raw]]) 
-  * https://windows.php.net/qa/+  * https://windows.php.net/qa/ ([[https://windows.php.net/downloads/qa/|raw]])
   * x64 Non Thread Safe   * x64 Non Thread Safe
   * Last tested: ''php-8.5.1-nts-Win32-vs17-x64.zip''   * Last tested: ''php-8.5.1-nts-Win32-vs17-x64.zip''
Line 47: Line 41:
 **** ****
  
-  DIR "%SystemDrive%\nginx-1.29.4\nginx.exe" && "netsh.exe" advfirewall firewall add rule name="nginx" dir="in" action="allow" profile="any" program="%SystemDrive%\nginx-1.29.4\nginx.exe" protocol="tcp" localport="80,443"+  CD "%SystemDrive%\nginx-"*"\" && "netsh.exe" advfirewall firewall add rule name="nginx" dir="in" action="allow" profile="any" program="%CD%\nginx.exe" protocol="tcp" localport="80,443
 + 
 +===== Delete Rule ===== 
 + 
 +**** 
 + 
 +  "netsh.exe" advfirewall firewall delete rule name="nginx"
  
 ====== Check Defaults ====== ====== Check Defaults ======
Line 55: Line 55:
 **** ****
  
-  nano '/etc/nginx/nginx.conf~'+  CD "%SystemDrive%\nginx-"*"\conf" && "notepad.exe" "nginx.conf"
  
 ==== PHP ==== ==== PHP ====
  
-  nano '/etc/php8/fpm/php-fpm.d/www.conf~'+  CD "%SystemDrive%\php-"*"-nts-Win32-"*"-x64\" && "notepad.exe" "php.ini-production"
  
-  nano '/etc/php8/fpm/php-fpm.conf'+  CD "%SystemDrive%\php-"*"-nts-Win32-"*"-x64\" && "notepad.exe" "php.ini-development"
  
-  nano '/etc/php8/fpm/php.ini'+====== nginx Settings ======
  
-  nano '/etc/php8/cli/php.ini'+===== confs =====
  
-==== confs ====+  MKDIR "%SystemDrive%\www\nginx\conf" & CD "%SystemDrive%\nginx-"*"\conf" && COPY /Y "fastcgi_params" "%SystemDrive%\www\nginx\conf\fastcgi_params"
  
-  MKDIR "%SystemDrive%\www\nginx\conf"+  MKDIR "%SystemDrive%\www\nginx\conf" & CD "%SystemDrive%\nginx-"*"\conf" && COPY /Y "mime.types" "%SystemDrive%\www\nginx\conf\mime.types"
  
-  COPY /Y "%SystemDrive%\nginx-1.29.4\conf\fastcgi_params" "%SystemDrive%\www\nginx\conf" +===== Folders =====
- +
-  COPY /Y "%SystemDrive%\nginx-1.29.4\conf\mime.types" "%SystemDrive%\www\nginx\conf" +
- +
-==== Firewall ===+
- +
- +
-=== Delete Rule ===+
  
 **** ****
  
-  "netsh.exe" advfirewall firewall delete rule name="nginx" +  MKDIR "%SystemDrive%\www\php" "%SystemDrive%\www\nginx\conf.d" "%SystemDrive%\www\nginx\default.d" "%SystemDrive%\www\nginx\vhosts.d"
- +
-====== nginx Settings ====== +
- +
-===== Folders ===== +
- +
-  MKDIR "%SystemDrive%\www\php" +
- +
-  MKDIR "%SystemDrive%\www\nginx\conf.d" +
- +
-  MKDIR "%SystemDrive%\www\nginx\default.d" +
- +
-  MKDIR "%SystemDrive%\www\nginx\vhosts.d"+
  
 ===== HTTPS Redirect ===== ===== HTTPS Redirect =====
Line 114: Line 95:
 ===== Non-existent 404 ===== ===== Non-existent 404 =====
  
-  * This prevents unconfigured subdomains from loading assets from other sites ((if a site/URL doesn'exist, it'll 404))+  * This prevents unconfigured subdomains from loading assets from other sites ((if a site/URL doesn'have a ''vhosts.d\*.conf'', it'll 404))
  
   "notepad.exe" "%SystemDrive%\www\nginx\conf.d\non-existent.conf"   "notepad.exe" "%SystemDrive%\www\nginx\conf.d\non-existent.conf"
Line 140: Line 121:
 add_header "X-Frame-Options" "sameorigin" "always"; add_header "X-Frame-Options" "sameorigin" "always";
 add_header "X-XSS-Protection" "1; mode=block" "always"; add_header "X-XSS-Protection" "1; mode=block" "always";
-add_header "Cache-Control" "no-store, no-transform, public" "always";+add_header "Cache-Control" "max-age=604800, no-transform, public" "always";
 add_header "Referrer-Policy" "same-origin" "always"; add_header "Referrer-Policy" "same-origin" "always";
 add_header "Expect-CT" "max-age=0" "always"; add_header "Expect-CT" "max-age=0" "always";
Line 183: Line 164:
  
 # End</code> # End</code>
 +
 +  CD "%SystemDrive%\nginx-"*"\" && "nginx.exe" -c "%SystemDrive%\www\nginx\nginx.conf" -t
  
 ==== CSP Headers ==== ==== CSP Headers ====
Line 232: Line 215:
 @echo off @echo off
  
 +TITLE nginx
 CD "%SystemDrive%\nginx-"*"\" CD "%SystemDrive%\nginx-"*"\"
  
Line 247: Line 231:
 @echo off @echo off
  
 +TITLE nginx Stop
 CD "%SystemDrive%\nginx-"*"\" CD "%SystemDrive%\nginx-"*"\"
  
 "nginx.exe" -s "quit" "nginx.exe" -s "quit"
 +
 +TIMEOUT /T "2" /NOBREAK
 +TASKKILL /IM "nginx.exe" /T /F
 +
 +CD "%Temp%"
  
 :: End</code> :: End</code>
Line 266: Line 256:
 "nginx.exe" -s "reload" "nginx.exe" -s "reload"
 "nginx.exe" -s "reopen" "nginx.exe" -s "reopen"
 +
 +CD "%Temp%"
  
 :: End</code> :: End</code>
Line 273: Line 265:
 ====== Task Scheduler ====== ====== Task Scheduler ======
  
-****+===== nginx ===== 
 + 
 +  Auto-start
  
   SCHTASKS /Create /SC "ONLOGON" /TN "nginx" /TR "%SystemDrive%\www\scripts\nginx\Start.bat" /F   SCHTASKS /Create /SC "ONLOGON" /TN "nginx" /TR "%SystemDrive%\www\scripts\nginx\Start.bat" /F
/usr/local/www/wiki/data/attic/servers/windows/nginx_php_php-cgi.1768659633.txt.gz · Last modified: by Sean Rhone