- map $request_uri $redirect_fbclid {
- "~^(.*?)([?&]fbclid=[a-zA-Z0-9_-]+)$" $1;
- }
- server {
- listen 80;
- server_name blog.rednet.ge;
- #return 301 https://blog.rednet.ge$request_uri;
- root /var/www/html/wordpress;
- }
- server {
- listen 443 ssl http2;
- server_name blog.rednet.ge;
- keepalive_timeout 70;
- ssl_certificate /etc/letsencrypt/live/blog.rednet.ge/fullchain.pem;
- ssl_certificate_key /etc/letsencrypt/live/blog.rednet.ge/privkey.pem;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- ssl_ciphers HIGH:!aNULL:!MD5;
- gzip on;
- gzip_static on;
- ssl_session_cache shared:SSL:10m;
- ssl_session_timeout 10m;
- charset UTF-8;
- root /var/www/html/wordpress;
- if ( $redirect_fbclid ) {
- return 301 $redirect_fbclid;
- }
- set $cache_uri $request_uri;
- # bypass cache if POST requests or URLs with a query string
- if ($request_method = POST) {
- set $cache_uri 'nullcache';
- }
- if ($query_string != "") {
- set $cache_uri 'nullcache';
- }
- # bypass cache if URLs containing the following strings
- if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(index)?.xml|[a-z0-9-]+-sitemap([0-9]+)?.xml)") {
- set $cache_uri 'nullcache';
- }
- # bypass cache if the cookies containing the following strings
- if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
- set $cache_uri 'nullcache';
- }
- # default html file
- set $cache_enabler_uri '/wp-content/cache/cache-enabler/${http_host}${cache_uri}index.html';
- location / {
- gzip_static on; # this directive is not required but recommended
- try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
- index index.html index.htm index.php;
- }
- #error_page 404 /404.html;
- # redirect server error pages to the static page /50x.html
- #
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/html;
- }
- location ~ \.php$ {
- try_files $uri =404;
- fastcgi_pass unix:/var/run/php-fpm.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- location ~* \.css$ {
- etag on;
- gzip_vary on;
- expires 30d;
- }
- location ~* \.js$ {
- etag on;
- gzip_vary on;
- expires 30d;
- }
- location ~* \.(ico|gif|jpe?g|png|svg|eot|otf|woff|woff2|ttf|ogg)$ {
- etag on;
- expires 30d;
- }
- location ~ /\.ht {
- deny all;
- }
- }