Welcome! Log In Create A New Profile

Advanced

hotlink protection for wordpress

Max
February 01, 2010 05:24AM
Hello,

I tried to add some rewrite rule to block hotlinking from other web sites.
But the rules don't work, I go to my site (e.g. domain1.com), the images
won't load at all (using wordpress as the cms). Is there anything wrong for
my conf file? Thanks.

server {
listen 123.123.123.123:80;
server_name domain1.com www.domain1.com;

#charset koi8-r;

access_log /home/logs/domain1.com.log;
error_log /home/logs/domain1.com.error.log;

location / {
root /home/user/docs;
index index.php index.html index.htm;
include /usr/local/nginx/conf/wp-rewrite;
}

location ~ \.(jpg|jpeg|png|gif)$ {
valid_referers www.domain1.com blocked none;
if ($invalid_referer) {
rewrite ^(.*)$ /wp-content/uploads/av.gif break;
}
}

location /zp {

root /home/user/docs;
index index.php;
include /usr/local/nginx/conf/zp-rewrite;
}


error_page 404 /404.html;
location = /404.html {
root /usr/local/nginx/html;
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /home/user/docs;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/home/user/docs$fastcgi_script_name;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

hotlink protection for wordpress

Max February 01, 2010 05:24AM

Re: hotlink protection for wordpress

Igor Sysoev February 01, 2010 12:54PM

Re: hotlink protection for wordpress

任晓磊 February 02, 2010 02:54AM

Re: hotlink protection for wordpress

Max February 04, 2010 02:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 124
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready