EasyDigitalDownload configuration


#1

I am testing EasyDigitalDownload with EasyEngine for the potential chances.

When I follow the following link, I couldn’t start nginx, so I am confusing the solution is OK for the time being.

Here is full configuration of /etc/nginx/site-avilable/xxx.com

server {

server_name xxx.com   www.xxx.com;


access_log /var/log/nginx/xxx.com.access.log rt_cache;
error_log /var/log/nginx/xxx.com.error.log;


root /var/www/www.com/htdocs;


index index.php index.html index.htm;


include common/php7.conf;

include common/wpcommon-php7.conf;
include common/locations-php7.conf;
include /var/www/fridababy.co.kr/conf/nginx/*.conf;

}

location ~ ^/wp-content/uploads/edd/(.*?).zip$ { rewrite / permanent; }

How can I solve? I think the previous solution is not working, or my configuration is wrong. There are some description or solution, but I couldn’t solve it by myself.

https://docs.easydigitaldownloads.com/article/682-protected-download-files-on-nginx


#2

You can’t add a “location…” outside the server block, so that’s why nginx is failing to start.

It’s also wise to run sudo nginx -t after you make any config changes - this tests your changes for any errors without putting them live.


#3

It is much safer to save your custom conf at /var/www/yoursite.com/conf/nginx

Let’s say the file name is edd.conf. So it will be /var/www/yoursite.com/conf/nginx/edd.conf

Add this rules (without the server block):

location ~ ^/wp-content/uploads/edd/(.*?)\.zip$ { rewrite / permanent; }
rewrite ^/wp-content/uploads/edd/(.*)\.zip$ / permanent;

Reload your nginx:

sudo nginx -t && sudo ee stack reload --nginx