File Manager

Current Path : /etc/nginx/sites-enabled/
Upload File :
Current File : //etc/nginx/sites-enabled/www.beetasty.be.conf

fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;


    server {
        listen	162.19.25.26:80;
        server_name www.beetasty.be ovh.beetasty.be beetasty.be;
    	return 301 https://www.beetasty.be$request_uri;	
    }
    server {
	listen	162.19.25.26:443 ssl http2;
        server_name www.beetasty.be;

	ssl_certificate /etc/nginx/certs/beetasty/www.beetasty.be-bundle-2024.crt;
	ssl_certificate_key /etc/nginx/certs/beetasty/www.beetasty.be-2024.key;

	ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
	ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';

	ssl_prefer_server_ciphers on;
	ssl_dhparam /etc/nginx/dhparams.pem;

        root   /webspace/www.beetasty.be/html;
        index  index.php;
        access_log  /webspace/www.beetasty.be/log/access.log main buffer=32k;
	error_log   /webspace/www.beetasty.be/log/error.log;
       # error_page   404          /404.html;
       # error_page   502 503 504  /50x.html;

	# opt from https://www.cloudpanel.io/blog/nginx-performance/
	server_tokens off;

	location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

	# securize wp-login against brute force
	location = /wp-login.php {
 	   	limit_req   zone=one;#  burst=1 nodelay;
		include snippets/fastcgi-php.conf;
                #
                #     # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/var/run/php/php7.4-fpm-bee.sock;
	}


	set $skip_cache 0;

    	# POST requests and URLs with a query string should always go to PHP
    	if ($request_method = POST) {
    	    set $skip_cache 1;
    	}   

    	if ($query_string != "") {
    	   set $skip_cache 1;
    	}   

	# Skip cache for WooCommerce query string
	if ( $arg_add-to-cart != "" ) { 
 	     set $skip_cache 1;
	}

    	# Don't cache URIs containing the following segments
	if ($request_uri ~* "(/fr/panier.*|/nl/winkelkarretje.*|/cart.*|/fr/my-account.*|/nl/mijn-account.*|/fr/checkout.*|/nl/afronden.*|/addons.*|/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 $skip_cache 1;
	}
    	
	# Don't use the cache for logged-in users or recent commenters
    	if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass |wordpress_no_cache|wordpress_logged_in") {
    	    set $skip_cache 1;
    	}

        location / {
                # This is cool because no php is touched for static content.
                # include the "?$args" part so non-default permalinks doesn't break when using query string
                try_files $uri $uri/ /index.php?$args;
	}

        location ~ \.php$ {
		set $rt_session "";

		if ($http_cookie ~* "wp_woocommerce_session_[^=]*=([^%]+)%7C") {
               		set $rt_session wp_woocommerce_session_$1;
       		}	

		if ($skip_cache = 0 ) {
			more_clear_headers "Set-Cookie*";
			set $rt_session "";
		}

	        fastcgi_cache_key "$scheme$request_method$host$request_uri$rt_session";


                include snippets/fastcgi-php.conf;
                #
                #     # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/var/run/php/php7.4-fpm-bee.sock;
         	
		fastcgi_cache_bypass $skip_cache;
	        fastcgi_no_cache $skip_cache;

		fastcgi_cache WORDPRESS;
		fastcgi_cache_valid  60m;

       
        }

	
	location ~ /purge(/.*) {
        	fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";
    	}	
	
	# Cache this content
	location ~* ^.+.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {

        	access_log off;	
        	log_not_found off;
		expires 2w;
		add_header Cache-Control "public, no-transform";
		allow all;
	}

	# PHP-FPM status page
	location ~ ^/(status-7.4|ping-7.4)$ {
		access_log off;
		allow 127.0.0.1;
		#allow 188.118.10.185; 
		#allow 85.234.198.42;
		#allow 79.132.232.139;
		allow 213.219.159.4; 
		deny all;
		include /etc/nginx/fastcgi_params; # REMARK: not touched
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_pass unix:/var/run/php/php7.4-fpm-bee.sock;
	}

	# deny access to apache .htaccess files
	location ~ /\.ht
	{
		deny all;
	}
rewrite ^/fr/categorie-produit/vente-miel-artisanal-belgique$ https://www.beetasty.be/fr/categorie-produit/miel-artisanal-belgique/ permanent;
rewrite ^/fr/bsfb$ https://forms.gle/viiFQebPXKjWu9KD7;
rewrite ^/visites https://www.beetasty.be/fr/a-la-decouverte-des-abeilles/;

# START Nginx Rewrites for Rank Math Sitemaps
rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
rewrite ^/([a-z]+)?-sitemap.xsl$ /index.php?xsl=$1 last;
# END Nginx Rewrites for Rank Math Sitemaps
}    

File Manager Version 1.0, Coded By Lucas
Email: hehe@yahoo.com