1. server
    2. {
    3. listen 80;
    4. #listen [::]:80;
    5. server_name dot.test.com;
    6. location = /favicon.ico { access_log off; log_not_found off; }
    7. location = /robots.txt { access_log off; log_not_found off; }
    8. location ~ ^/api/reportLocation
    9. {
    10. default_type application/json;
    11. access_log /alidata/log/nginx/xiaode_dot/xiaode_reportLocation.log dot;
    12. return 200 '{"code":200,"msg":"success"}';
    13. }
    14. location ~^/dot/
    15. {
    16. default_type text/html;
    17. access_log /alidata/log/nginx/dot.test.com.log;
    18. return 200 'su';
    19. }
    20. location /
    21. {
    22. default_type text/html;
    23. access_log off;
    24. return 404 'fail';
    25. }
    26. access_log off;
    27. error_log /dev/null crit;
    28. }

    NGINX 输出配置说明:

    # 直接返回文本:
    
        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";
        }