Linux命令 Nginx return
原文链接: Linux命令 Nginx return
server {
server_name foo.com;
return 301 http://$server_name$request_uri;
}
server {
listen 80;
server_name nowamagic.net www.nowamagic.net;
if ($host != 'www.nowamagic.net' ) {
rewrite ^/(.*)$ http://www.nowamagic.net/$1 permanent;
rewrite ^(.*) http://www.nowamagic.net$1 permanent;
}
}
return 301 /upgrade;
nginx 升级页面
location /upgrade {
add_header Content-Type 'text/html; charset=utf-8';
return 200 "系统正在更新,请稍等10分钟后重试!";
}
可以再nginx里面加入
if (-f $document_root/system/maintenance.html) {
return 503;
}
location @503 {
rewrite ^(.*)$ /system/maintenance.html break;
}
需要maintenance的时候,就把maintenance.html拷贝到public/system/maintenance.htm 也可以写个cap recipe做这个