File: //etc/nginx/conf.d/www.simplipay.earth.conf
server {
# Server Name
server_name www.simplipay.earth;
# Root Directory
root /var/www/html/simplipay.earth;
index index.php index.html index.htm;
# Access and Error Logs
access_log /var/log/nginx/simplipay.earth_access.log;
error_log /var/log/nginx/simplipay.earth_error.log;
# Enabling Gzip Compression
gzip on;
gzip_types text/css application/javascript image/svg+xml application/rss+xml text/plain text/xml application/xml application/json application/ld+json font/woff2;
gzip_min_length 1000;
# Prevent Access to Hidden Files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Deny Access to WordPress Config
location ~* wp-config.php {
deny all;
}
# Deny Access to XMLRPC
location ~* xmlrpc\.php {
deny all;
log_not_found off;
access_log off;
}
# Allow Access to Favicon and Robots.txt
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Static Files Optimization
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|webp|woff|woff2|ttf|otf|eot|ttc|mp4|mp3|mov|ogg|webm|avi|wmv|m4a|pdf|doc|xls|ppt|txt|zip|tar|gz|rar|bz2|7z|iso|dmg|tgz|xml|ttf)$ {
expires max;
log_not_found off;
}
# WordPress Permalinks
location / {
try_files $uri $uri/ /index.php?$args;
}
# PHP-FPM Configuration
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.2-fpm.sock; # Update PHP version if necessary
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
# Secure WordPress Uploads Directory
location ~* /wp-content/uploads/.*\.php$ {
deny all;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.simplipay.earth/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.simplipay.earth/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.simplipay.earth) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name www.simplipay.earth;
listen 80;
return 404; # managed by Certbot
}