我正在将我的网站移动到我的新服务器,以便在全球DNS记录中更新IP时保持同步,我想在我的旧服务器上放置一条临时消息,以阻止任何进一步的活动。
我的配置
server {
listen 80 default; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /var/www/nginx-default;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
index index.html index.htm index.php;
}
location /mirror {
rewrite ^(.*)$ http://example.com/mirror/moving.php redirect;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
index index.php;
}
我想阻止的网站位于/ mirror中,我希望从该文件夹(包含的文件)开始的每个请求都被重定向到/mirror/moving.php。当前规则适用于每个请求和文件,但不适用于正常提供的.php文件,我想因为它们被传递给php5-fpm。 有解决方法吗?