Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ironman199xx

    (@ironman199xx)


    Thank you very much. Finally, after many days of trying, I have successfully converted the images to webp using your plugin. My nginx configuration file is located at /usr/local/openresty/nginx/conf/conf.d/main.conf, and here is its full content after being configured according to your instructions.

    # Add your custom config in custom/user.conf
    # ALL CHANGES IN THIS FILE WILL BE LOST AFTER EasyEngine Update
    
    upstream php {
    	server mydomain.com_php:9000;
    }
    
    
    server {
    
    	access_log   /var/log/nginx/access.log;
    	error_log    /var/log/nginx/error.log;
    
    	root /var/www/htdocs;
    
    	server_name mydomain.com;
    
    	index index.php index.html index.htm;
    # BEGIN Converter for Media
        set $ext_avif ".avif";
        if ($http_accept !~* "image/avif") {
            set $ext_avif "";
        }
    
        set $ext_webp ".webp";
        if ($http_accept !~* "image/webp") {
            set $ext_webp "";
        }
    
        location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif|webp)$ {
            add_header Vary Accept;
            expires 365d;
            try_files
                /wp-content/uploads-webpc/$path.$ext$ext_avif
                /wp-content/uploads-webpc/$path.$ext$ext_webp
                $uri =404;
        }
        # END Converter for Media
    
    
    
    	# PHP NGINX CONFIGURATION
    	location / {
    		try_files $uri $uri/ /index.php?$args;
    	}
    	location ~ \.php$ {
    		try_files $uri =404;
    		fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    		include fastcgi_params;
    		fastcgi_pass php;
    	}
    
    	# WordPress COMMON SETTINGS
    	# Limit access to avoid brute force attack
    	location = /wp-login.php {
    		limit_req zone=one burst=1 nodelay;
    		include fastcgi_params;
    		fastcgi_pass php;
    	}
    	# Disable wp-config.txt
    	location = /wp-config.txt {
    		deny all;
    		access_log off;
    		log_not_found off;
    	}
    	# Disallow php in upload folder
    	location /wp-content/uploads/ {
    		location ~ \.php$ {
    			#Prevent Direct Access Of PHP Files From Web Browsers
    			deny all;
    		}
    	}
    
    	# NGINX CONFIGURATION FOR COMMON LOCATION
    	# Basic locations files
    	location = /favicon.ico {
    		access_log off;
    		log_not_found off;
    		expires max;
    	}
    
    	location = /robots.txt {
    	# Some WordPress plugin gererate robots.txt file
    	# Refer #340 issue
    		try_files $uri $uri/ /index.php?$args;
    		access_log off;
    		log_not_found off;
    	}
    	# Cache static files
    	location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|woff2|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf)$ {
    		add_header "Access-Control-Allow-Origin" "*";
    		access_log off;
    		log_not_found off;
    		expires max;
    	}
    	# Security settings for better privacy
    	# Allow LetsEncrypt HTTP challenge URL
    	location ^~ /.well-known/acme-challenge/ {
    		auth_basic off;
    		allow all;
    		try_files $uri =404;
    		break;
    	}
    	# Deny hidden files
    	location ~ /\. {
    		deny all;
    		access_log off;
    		log_not_found off;
    	}
    
    	# Deny backup extensions & log files
    	location ~* ^.+\.(bak|log|old|orig|original|php#|php~|php_bak|save|swo|swp|sql)$ {
    		deny all;
    		access_log off;
    		log_not_found off;
    	}
    	# Return 403 forbidden for readme.(txt|html) or license.(txt|html) or example.(txt|html)
    	if ($uri ~* "^.+(readme|license|example)\.(txt|html)$") {
    		return 403;
    	}
    	# Status pages
    	location = /ee-admin/nginx_status {
    		stub_status on;
    		access_log off;
    	}
    	location = /ee-admin/status {
    		include fastcgi_params;
    		fastcgi_pass php;
    	}
    	location = /ee-admin/ping {
    		include fastcgi_params;
    		fastcgi_pass php;
    	}
    	location ~*  \.(css|js)$ {
    		access_log off;
    		expires 1d;
    		add_header Cache-Control "public, must-revalidate";
    	}
    
    
    	client_max_body_size 100m;
    
    	include /usr/local/openresty/nginx/conf/custom/*.conf;
    }

    I hope it will be helpful for others, like me, who are working with your plugin. Thank you once again.

    Thread Starter ironman199xx

    (@ironman199xx)

    Good morning! To have a better understanding of how my Nginx server works, please take a minute to read this Nginx configuration guide: https://github.com/openresty/docker-openresty/blob/master/README.md#nginx-config-files.

    If you would like to have direct access to my server to help solve my issue, I can provide you with the server’s IP and root account details. Just send me an email, and I will share my account information with you through that.

    Thread Starter ironman199xx

    (@ironman199xx)

    Thanks for your answer, but I have tried configuring according to your video instructions many times, and the configuration can’t seem to pass nginx’s syntax check. Please provide me with more solutions to solve this problem. I have worked hard for 2 weeks to convert images to webp, but it seems that my nginx configuration is not correct. I know your plugin is very good because I have used many image conversion plugins before, and I believe you can help me solve my problem. I configured the site on a VPS using EasyEngine, and nginx runs in a Docker container.

Viewing 3 replies - 1 through 3 (of 3 total)