一般网站的后台都不能给外部访问,所以要添加IP限制,通常只允许公司的IP访问

限制整个域名访问就要server下添加:

server {

listion 80;
server_name lihuipeng.blog.51cto.com;
root /opt/htdocs/www;

allow   100.100.100.100;
deny    all;

还可以做到PHP的解释限制:

 location ~ .*\.php?$
{

allow   100.100.100.100;
deny    all;

fastcgi_pass  127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}

除了限制IP之然还可以给域名添加帐号码密验证:

 server {

listion 80;
server_name lihuipeng.blog.51cto.com;
root /opt/htdocs/www;

allow   100.100.100.100;
deny    all;
auth_basic “lihuipeng website”;
auth_basic_user_file htpasswd;

location ~ .*\.php?$
{
….
}

htpasswd 这个密码很眼熟吧,就是用apache生成的,也有在线生成htpasswd的!