flag | Explanation |
---|---|
last | nginx location redirection section 200 can be directly returned status code |
break | nginx redirect resource path 200 can be directly returned status code |
redirect | Returned 302 temporary redirect |
permanent | Returned 301 permanent redirect |
server {
listen 6935;
server_name www.siguoya.name;
root /usr/local/nginx/1.12.1/html;
# 如果没有/usr/local/nginx/1.12.1/html/test目录的话,就直接返回404
location /break {
rewrite /break /test break;
}
# 重定向/last区段的请求到/test区段
location /last {
rewrite /last /test last;
}
#302
location /redirect {
rewrite /redirect /test redirect;
}
#301
location /permanent {
rewrite /permanent /test permanent;
}
location /test {
default_type application/json;
return 200 '{"status":"success"}';
}
}
Read topics
- 1. Nginx advantage
- 2. Nginx installation and boot from Kai
- 3. Nginx configuration syntax and directories
- 4. Nginx module
- 5. Nginx handling the static resources
- 6. Nginx browser cache principle
- 7. Cross-domain access resources Nginx
- Anti-theft chain 8. Nginx resources
- 9. Nginx proxy
- 10. Nginx Load Balancing
- 11. Nginx cache
- 12. Nginx static and dynamic separation
- 13. Nginx Rewrite
- 14. Nginx Secure Link
- 15. Nginx Geo
- 16. Nginx HTTPS service
- 17. Nginx and development of Lua
- 18. Nginx release and gray Lua
- 19. Nginx common errors
- 20. Nginx performance optimization
- 21. Nginx Security Management