User Tools

Site Tools


servers:linux:nginx_php_php-fpm

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:linux:nginx_php_php-fpm [2025/12/20 19:17] – [Headers] Sean Rhoneservers:linux:nginx_php_php-fpm [2026/01/07 02:58] (current) – old revision restored (2026/01/04 14:27) Sean Rhone
Line 8: Line 8:
 ===== Prerequisites ===== ===== Prerequisites =====
  
-  * [[linux:distros:server:ubuntu_server|Ubuntu Server]]+  * [[linux:distros:server:opensuse_tumbleweed_server|openSUSE Tumbleweed (Server)]]
  
 ====== Dependencies ====== ====== Dependencies ======
Line 14: Line 14:
 **** ****
  
-  sudo apt install git nginx-light php-fpm+  sudo zypper install git-core nginx php8-cli php8-fpm php8-opcache
  
 ====== Information ====== ====== Information ======
Line 24: Line 24:
 ====== Firewall ====== ====== Firewall ======
  
-  * [[linux:notes:ufw_uncomplicated_firewall|ufw Notes]]+  * [[linux:notes:firewalld|Firewalld Notes]]
   * TODO: ''QUIC''   * TODO: ''QUIC''
  
-  sudo ufw allow 'Nginx HTTP' +  sudo firewall-cmd --add-service='http--permanent && sudo firewall-cmd --add-service='https--permanent && sudo firewall-cmd --reload
- +
-  sudo ufw allow 'Nginx HTTPS' +
- +
-===== Disable IPv6 ===== +
- +
-  sudo ufw status numbered +
- +
-  sudo ufw delete '5' +
- +
-  sudo ufw delete '4'+
  
 ====== Services ====== ====== Services ======
  
-  sudo systemctl enable 'nginx' 'php8.4-fpm'+  sudo systemctl enable 'nginx' 'php-fpm'
  
-  sudo systemctl stop 'nginx' 'php8.4-fpm'+  sudo systemctl stop 'nginx' 'php-fpm'
  
 ===== Start ===== ===== Start =====
Line 49: Line 39:
   sudo systemctl start 'nginx'   sudo systemctl start 'nginx'
  
-  sudo systemctl start 'php8.4-fpm'+  sudo systemctl start 'php-fpm'
  
 ====== Disable Defaults ====== ====== Disable Defaults ======
Line 55: Line 45:
 ===== nginx ===== ===== nginx =====
  
-  sudo rm '/etc/nginx/sites-enabled/default' +****
- +
-  sudo mv '/etc/nginx/modules-enabled/50-mod-http-echo.conf' '/etc/nginx/modules-available/50-mod-http-echo.conf'+
  
   sudo mv '/etc/nginx/nginx.conf' '/etc/nginx/nginx.conf~'   sudo mv '/etc/nginx/nginx.conf' '/etc/nginx/nginx.conf~'
Line 63: Line 51:
 ===== PHP-FPM ===== ===== PHP-FPM =====
  
-  :!: Run after [[servers:linux:nginx:dokuwiki#dependencies|first website set-up]] ((breaks ''apt-get'' PHP module install when ''dpkg'' restarts the FPM service; no existing conf causes daemon to fail to restart))+****
  
-  sudo mv '/etc/php/8.4/fpm/pool.d/www.conf' '/etc/php/8.4/fpm/pool.d/www.conf~'+  sudo mv '/etc/php8/fpm/php-fpm.d/www.conf' '/etc/php8/fpm/php-fpm.d/www.conf~'
  
 ===== Check Defaults ===== ===== Check Defaults =====
Line 71: Line 59:
 ==== nginx ==== ==== nginx ====
  
-  nano '/etc/nginx/sites-available/default'+****
  
   nano '/etc/nginx/nginx.conf~'   nano '/etc/nginx/nginx.conf~'
Line 77: Line 65:
 ==== PHP ==== ==== PHP ====
  
-  * ''php.ini'' is in both ''fpm'' and ''cli'' folders +  nano '/etc/php8/fpm/php-fpm.d/www.conf~'
- +
-  nano '/etc/php/8.4/fpm/pool.d/www.conf~'+
  
-  nano '/etc/php/8.4/fpm/php-fpm.conf'+  nano '/etc/php8/fpm/php-fpm.conf'
  
-  nano '/etc/php/8.4/fpm/php.ini'+  nano '/etc/php8/fpm/php.ini'
  
-  nano '/etc/php/8.4/cli/php.ini'+  nano '/etc/php8/cli/php.ini'
  
 ====== nginx Settings ====== ====== nginx Settings ======
 +
 +===== Notes =====
 +
 +  * ''conf.d'' contains **server-wide** modular configuration files
 +  * ''default.d'' contains **site-specific** modular configuration files
 +  * ''vhosts.d'' contains enabled websites ((this folder needs created))
 +
 +===== Folders =====
 +
 +****
 +
 +  sudo mkdir -p '/etc/nginx/default.d' '/etc/nginx/vhosts.d'
  
 ===== HTTPS Redirect ===== ===== HTTPS Redirect =====
Line 130: Line 128:
   * Add to individual site configs as an ''include''   * Add to individual site configs as an ''include''
  
-  sudo -e '/etc/nginx/snippets/headers.conf'+  sudo -e '/etc/nginx/default.d/headers.conf'
  
-<code>                                                                                 +<code>
 add_header 'Strict-Transport-Security' 'max-age=63072000; includeSubdomains; preload' 'always'; add_header 'Strict-Transport-Security' 'max-age=63072000; includeSubdomains; preload' 'always';
 add_header 'X-Content-Type-Options' 'nosniff' 'always'; add_header 'X-Content-Type-Options' 'nosniff' 'always';
Line 146: Line 144:
 ===== nginx ===== ===== nginx =====
  
-  sudo -e '/etc/nginx/nginx.conf' && sudo nginx -t+  sudo -e '/etc/nginx/nginx.conf'
  
 <code> <code>
-user www-data; 
-worker_processes auto; 
-worker_cpu_affinity auto; 
-pid /run/nginx.pid; 
- 
 events { events {
  multi_accept 'on';  multi_accept 'on';
Line 164: Line 157:
  
  # Logging  # Logging
 + #log_format main '$time_local - $http_host - $remote_addr - $status "$request" $body_bytes_sent - $http_referer - "$http_user_agent"';
 + #access_log '/var/log/nginx/access.log main';
 +
  access_log '/dev/null';  access_log '/dev/null';
  
  # Includes  # Includes
  include '/etc/nginx/conf.d/*.conf';  include '/etc/nginx/conf.d/*.conf';
- include '/etc/nginx/sites-enabled/*.conf';+ include '/etc/nginx/vhosts.d/*.conf';
  include '/etc/nginx/mime.types';  include '/etc/nginx/mime.types';
  default_type 'application/octet-stream';  default_type 'application/octet-stream';
/usr/local/www/wiki/data/attic/servers/linux/nginx_php_php-fpm.1766276259.txt.gz · Last modified: by Sean Rhone