Nginx WordPress Yapılandırmaları

Kasım 5, 2023
4
Share

Nginx WordPress Yapılandırmaları

PHP-FPM, FastCGI önbellek, SSL, güvenlik ayarları, .webp desteği ve phpMyAdmin (her ihtimale karşı!) ile WordPress için yalnızca Nginx, Apache içermeyen yapılandırmalar. Tercih ettiğiniz yapılandırma ve trafik ihtiyaçlarınız için .conf dosyalarını karıştırın ve eşleştirin.
Test ve uyumluluk

Bu, Ubuntu 16.04’te Nginx 1.12 kararlı dalı ve PHP 7.2 ile kapsamlı bir şekilde test edilmiştir ve birkaç üretim sitesinde çalışır durumdadır.
Nasıl kullanılır

  • Bir /conf.d dosyası seçin ve zevkinize göre karıştırın. Düzenlenmesi gereken example.com alanları için #TODO olup olmadığını kontrol edin.
  • nginx.conf ve bu klasörlerin geri kalanını Linux sunucunuzdaki /etc/nginx içine bırakın.
  • sudo nginx -t yazım hatalarını kontrol etmek için
  • sudo systemctl reload nginx
  • Şimdi yayındasın

Devam ediyor
Hala günlük kaydı, hız sınırlaması ve diğer birkaç ayar üzerinde çalışıyorum. İpuçları, öneriler ve çekme istekleri bırakmaktan çekinmeyin.

Şimdi gerekli ayarları içeren conf dosyasını bırakayım.

 

# Baseline Nginx configuration

##
# Resources
# https://github.com/h5bp/server-configs-nginx
# https://github.com/A5hleyRich/wordpress-nginx
# https://serversforhackers.com/
##

user www-data; # consider changing to your user on a single-user server
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
worker_rlimit_nofile 8192;

##
# Error logs
# in progress!
# error_log logs/error.log warn;
##

events {
  worker_connections 8000;
  multi_accept on;
  use epoll;
}

http {

  ##
  # Rate limiting
  # in progress!
  # limit_req_zone $binary_remote_addr zone=main:10m rate=60r/m;
  ##

  # Performance
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;

  # TODO
  types_hash_max_size 2048;
  server_names_hash_max_size 1024;
  server_names_hash_bucket_size 1024;

  # Security
  server_tokens off;

  # File types
  include /etc/nginx/mime.types;
  default_type application/octet-stream;

  # Timeout
  keepalive_timeout     20; # seconds - default 60
  client_body_timeout   60;
  client_header_timeout 60;
  send_timeout          60;

  # Buffering
  client_body_buffer_size  100K;
  client_header_buffer_size 1k;
  large_client_header_buffers 4 8k; # default

  # Upload sizes
  client_max_body_size 32m; # raise for phpMyAdmin database uploads

  # Gzip
  include /etc/nginx/global/http/gzip.conf;

  # FastCGI cache
  include /etc/nginx/global/http/cache-path.conf;

  # Use .webp - must be used with /server/webp-expires.conf to activate
  # include /etc/nginx/global/http/check-webp.conf;

  # Get server blocks
  include /etc/nginx/conf.d/*.conf;

}

Kaynak: https://github.com/davidegreenwald/Nginx-for-WordPress-Configurations/tree/master

Yandex.Metrica