转载 

nginx小技巧:直接输出配置文件文件(包括变量)

分类:nodejs    282人阅读    IT小君  2019-09-29 22:42
location / {
        return 502 "服务正在升级,请稍后再试……";
 }

 
直接返回文本:

        location / {
                default_type    text/plain;
                return 502 "服务正在升级,请稍后再试……";
        }
也可以使用html标签格式:

        location / {
                default_type    text/html;
                return 502 "服务正在升级,请稍后再试……";
        }
也可以直接返回json文本:

        location / {
                default_type    application/json;
                return 502 '{"status":502,"msg":"服务正在升级,请稍后再试……"}';
        }
  location ~ \.php$ {
                default_type    text/plain;
                return 502 "$document_root$fastcgi_script_name";
        }

 

来自:https://www.qiansw.com/nginx-return-text.html


支付宝打赏 微信打赏

如果文章对你有帮助,欢迎点击上方按钮打赏作者

 工具推荐 更多»