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 [2025/01/07 00:14] Sean Rhoneservers:windows:nginx_php_php-cgi [2025/04/18 11:29] (current) – [nginx] Sean Rhone
Line 2: Line 2:
  
   * nginx ((https://nginx.org/en/docs/windows.html))   * nginx ((https://nginx.org/en/docs/windows.html))
-  * PHP + PHP-CGI((https://windows.php.net/download/))+  * PHP + PHP-CGI ((https://windows.php.net/download/))
   * [[Information:Realm of Espionage]]   * [[Information:Realm of Espionage]]
  
 ===== Prerequisites ===== ===== Prerequisites =====
  
-  * [[windows:10|Windows 10]]+  * [[windows;11_ltsc|Windows 11 (24H2)]]
  
 ====== Install ====== ====== Install ======
Line 14: Line 14:
  
   * https://nginx.org/en/download.html   * https://nginx.org/en/download.html
-  * Last tested: ''nginx-1.27.3.zip''+  * Last tested: ''nginx-1.27.5.zip''
  
-  * Extract to root system drive for ''C:\nginx-1.27.3\nginx.exe''+  * Extract to root system drive for ''C:\nginx-1.27.5\nginx.exe''
  
-  CD "%SystemDrive%\nginx-"*"\" && DIR "nginx.exe"+  explorer "%SystemDrive%"
  
-  CD "%SystemDrive%\nginx-"*"\" && explorer "."+  CD "%SystemDrive%\nginx-"*"\" && "nginx.exe-v
  
-===== PHP-CGI =====+==== confs ====
  
-  * https://windows.php.net/download/ +  MKDIR "%SystemDrive%\www\nginx\conf"
-  * x64 Non Thread Safe +
-  * Last tested: ''php-8.4.2-nts-Win32-vs17-x64.zip''+
  
-  * Extract to root system drive for ''C:\php-8.4.2-nts-Win32-vs17-x64\php-cgi.exe''+  COPY /Y "%SystemDrive%\nginx-1.27.5\conf\fastcgi_params" "%SystemDrive%\www\nginx\conf"
  
-  CD "%SystemDrive%\php-"*"-nts-Win32-"*"-x64\" && DIR "php-cgi.exe"+  COPY /Y "%SystemDrive%\nginx-1.27.5\conf\mime.types" "%SystemDrive%\www\nginx\conf"
  
-  CD "%SystemDrive%\php-"*"-nts-Win32-"*"-x64\" && explorer "."+==== Firewall ====
  
-  * TODO:+  "netsh.exe" advfirewall firewall add rule name="nginx" dir="in" action="allow" profile="any" program="%SystemDrive%\nginx-1.27.5\nginx.exe" protocol="tcp" localport="80,443"
  
-<code>SETX "Path" "%SystemDrive%\php-8.4.2-nts-Win32-vs17-x64"</code>+  "netsh.exeadvfirewall firewall delete rule name="nginx"
  
-===== PHP Extensions =====+===== PHP-CGI =====
  
-==== Verify Modules ====+==== 8.4 ====
  
-  CD "%SystemDrive%\php-"*"-nts-Win32-"*"-x64\" && "php.exe" -m+  * https://windows.php.net/download/ 
 +  x64 Non Thread Safe 
 +  * Last tested: ''php-8.4.6-nts-Win32-vs17-x64.zip''
  
-  CD "%SystemDrive%\php-"*"-nts-Win32-"*"-x64\" && explorer "."+  * Extract to root system drive for ''C:\php-8.4.6-nts-Win32-vs17-x64\php-cgi.exe'' 
 +  * Add to user ''Path''
  
-====== Firewall ======+  explorer "%SystemDrive%"
  
-  * 80/tcp is HTTP +  CD "%SystemDrive%\php-8.4"*"-nts-Win32-"*"-x64\" && "php.exe" -v
-  443/tcp is HTTPS+
  
-  netsh advfirewall firewall add rule name="nginx HTTP" dir="in" action="allow" protocol="TCP" localport="80"+  "SystemPropertiesAdvanced.exe"
  
-  netsh advfirewall firewall add rule name="nginx HTTPS" dir="in" action="allow" protocol="TCP" localport="443"+  C:\php-8.4.6-nts-Win32-vs17-x64
  
 ====== nginx Settings ====== ====== nginx Settings ======
Line 67: Line 67:
   MKDIR "%SystemDrive%\www\nginx\vhosts.d"   MKDIR "%SystemDrive%\www\nginx\vhosts.d"
  
-  explorer "%SystemDrive%\www\"+  explorer "%SystemDrive%\www"
  
 ===== HTTPS Redirect ===== ===== HTTPS Redirect =====
Line 81: Line 81:
  
     return 301 https://$host$request_uri;     return 301 https://$host$request_uri;
-}</code>+} 
 + 
 +# End</code>
  
 ===== Non-existent 404 ===== ===== Non-existent 404 =====
Line 96: Line 98:
  
     return "404";     return "404";
-}</code>+} 
 + 
 +# End</code>
  
 ===== Headers ===== ===== Headers =====
Line 112: Line 116:
 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;
-add_header Permissions-Policy "geolocation=(), microphone=(), payment=(), usb=(), vr=(), magnetometer=(), midi=(), camera=(), ambient-light-sensor=(), accelerometer=()" always;</code>+add_header Permissions-Policy "geolocation=(), microphone=(), payment=(), usb=(), vr=(), magnetometer=(), midi=(), camera=(), ambient-light-sensor=(), accelerometer=()" always;
  
-===== nginx =====+# End</code>
  
-  * :!: ''mime.types'' include hard-coded to nginx version path+===== nginx =====
  
   notepad "%SystemDrive%\www\nginx\nginx.conf"   notepad "%SystemDrive%\www\nginx\nginx.conf"
Line 143: Line 147:
     include C:/www/nginx/conf.d/*.conf;     include C:/www/nginx/conf.d/*.conf;
     include C:/www/nginx/vhosts.d/*.conf;     include C:/www/nginx/vhosts.d/*.conf;
-    include C:/nginx-1.27.3/conf/mime.types;+    include C:/www/nginx/conf/mime.types;
     default_type application/octet-stream;     default_type application/octet-stream;
  
Line 202: Line 206:
 # End</code> # End</code>
  
-====== Batch Files ======+====== Scripts ======
  
-  MKDIR "%SystemDrive%\www\scripts"+  MKDIR "%SystemDrive%\www\scripts\nginx"
  
-  explorer "%SystemDrive%\www\scripts"+  explorer "%SystemDrive%\www\scripts\nginx"
  
 ===== Start ===== ===== Start =====
  
-  notepad "%SystemDrive%\www\scripts\nginx Start.bat"+  notepad "%SystemDrive%\www\scripts\nginx\Start.bat"
  
 <code> <code>
 CD "%SystemDrive%\nginx-"*"\" CD "%SystemDrive%\nginx-"*"\"
-"nginx.exe" -c "%SystemDrive%\www\nginx\nginx.conf"</code>+"nginx.exe" -c "%SystemDrive%\www\nginx\nginx.conf"
  
-  "%SystemDrive%\www\scripts\nginx Start.bat"+:: End</code>
  
 ==== Autostart ==== ==== Autostart ====
  
-  explorer "%ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp"+  explorer "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp"
  
-  "%SystemDrive%\www\scripts\nginx Start.bat"+  "%SystemDrive%\www\scripts\nginx\Start.bat"
  
   nginx   nginx
Line 228: Line 232:
 ===== Stop ===== ===== Stop =====
  
-  notepad "%SystemDrive%\www\scripts\nginx Stop.bat"+  notepad "%SystemDrive%\www\scripts\nginx\Stop.bat"
  
 <code> <code>
 CD "%SystemDrive%\nginx-"*"\" CD "%SystemDrive%\nginx-"*"\"
-"nginx.exe" -s quit</code>+"nginx.exe" -s quit
  
-  "%SystemDrive%\www\scripts\nginx Stop.bat"+:: End</code>
  
 ===== Reload ===== ===== Reload =====
  
-  notepad "%SystemDrive%\www\scripts\nginx Reload.bat"+  notepad "%SystemDrive%\www\scripts\nginx\Reload.bat"
  
 <code> <code>
 CD "%SystemDrive%\nginx-"*"\" CD "%SystemDrive%\nginx-"*"\"
 "nginx.exe" -s reload "nginx.exe" -s reload
-"nginx.exe" -s reopen</code>+"nginx.exe" -s reopen
  
-  "%SystemDrive%\www\scripts\nginx Reload.bat"+:: End</code>
  
 ====== TODOs ====== ====== TODOs ======
/srv/www/wiki/data/attic/servers/windows/nginx_php_php-cgi.1736226876.txt.gz · Last modified: by Sean Rhone