使用 easyengine 在 nginx 中创建 301 重定向

Create a 301 redirect in nginx using easyengine

I installed easyengine (https://rtcamp.com/easyengine/) on my local machine. I can login to it using ssh www-data@localhost command

I created a site ankit.com

I want to prevent direct download of http://ankit.com/wp-content/uploads/test.zip, for the same I want to create a 301 redirect to homepage of the site ankit.com

I tried to modify the file at /etc/nginx/sites-available/ankit.com, but unfortunately owner of that file is 'root' and I don't know what is password of 'root' user.

能否请您告诉我如何创建 301 重定向以便无法直接访问 zip 文件?

感谢您的帮助。 :)

我不确定你打算实现什么。

您可以使用添加位置块 deny 从外部世界访问。

如下所示:

location /wp-content/uploads {
    allow 127.0.0.1;
    deny all;
}

然后在某种令牌验证后让 php 脚本下载。 PHP 可以读取文件,因为它将是本地访问。