52 lines
1.8 KiB
Nginx Configuration File
52 lines
1.8 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name blog.p2pfoundation.net localhost;
|
|
|
|
# Default index file
|
|
index _index_ssl.html index.html;
|
|
|
|
# Serve WordPress core includes (CSS, JS, images)
|
|
location /wp-includes/ {
|
|
alias /usr/share/nginx/html/blog.p2pfoundation.net/public_html/wp-includes/;
|
|
expires 30d;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Serve wp-content assets (themes, uploads, minified CSS/JS)
|
|
location /wp-content/ {
|
|
alias /usr/share/nginx/html/blog.p2pfoundation.net/public_html/wp-content/;
|
|
expires 30d;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Health check endpoint
|
|
location /health {
|
|
return 200 'OK';
|
|
add_header Content-Type text/plain;
|
|
}
|
|
|
|
# Main location - serve cached pages
|
|
location / {
|
|
root /usr/share/nginx/html/blog.p2pfoundation.net/public_html/wp-content/cache/page_enhanced/blog.p2pfoundation.net;
|
|
try_files $uri/_index_ssl.html $uri/ $uri =404;
|
|
}
|
|
|
|
# Error pages
|
|
error_page 404 /404.html;
|
|
location = /404.html {
|
|
internal;
|
|
return 404 '<!DOCTYPE html><html><head><title>404 - Page Not Found</title></head><body><h1>Page Not Found</h1><p>The requested blog post could not be found.</p><p><a href="/">Return to homepage</a></p></body></html>';
|
|
add_header Content-Type text/html;
|
|
}
|
|
|
|
# Inject Umami analytics (rData) into all HTML pages
|
|
sub_filter '</head>' '<script defer src="https://rdata.online/collect.js" data-website-id="1faf3e11-797c-4733-90c3-c7f11a2592c5"></script></head>';
|
|
sub_filter_once on;
|
|
sub_filter_types text/html;
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_types text/plain text/html text/css application/javascript application/json;
|
|
gzip_min_length 1000;
|
|
}
|