In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-12-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to solve the problems encountered in nginx+uWsgi configuration, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
UWSGI is a deployment choice on servers like nginx, lighttpd, and cherokee. For more options, see FastCGI and stand-alone WSGI containers. You will first need a uWSGI server to use your WSGI application using the uWSGI protocol. UWSGI is not only a protocol, but also an application server that provides uWSGI, FastCGI, and HTTP protocols.
1. Redirect the response of the uwsgi server whose response code is greater than or equal to 300to nginx for processing using the error_page instruction
Uwsgi_intercept_errors on
2. Nginx simple filter crawler
# prohibit crawling if of crawler tools ($http_user_agent ~ * "python | curl | java | wget | httpclient | okhttp | Scrapy") {return 503;} # prohibit access to if ($http_user_agent ~ "WinHttp | WebZIP | node-superagent | java/ | Jullo | JikeSpider | Indy Library | Alexa Toolbar | AskTbFXTV | CrawlDaddy | Java | Feedly | Apache-HttpAsyncClient | ApacheBench | Microsoft URL Control | ZmEu | oBot | jaunty | oBot | jaunty | Python-urllib | | Python-urllib | lightDeckReports Bot | Python-urllib | Python-urllib | jaunty | Python-urllib | jaunty | Python-urllib | lightDeckReports Bot | lightDeckReports Bot | Python-urllib | Python-urllib | jaunty | Python-urllib | jaunty | jaunty | Python-urllib | Python-urllib |
3. Http request is redirected to https
# http jumps to httpsset $flag 0bot if ($host = "wxapp.zyqcn.cn") {set $flag "${flag} 1";} if ($scheme = "http") {set $flag "${flag} 2";} if ($flag = "012") {rewrite ^ (. *) https://$host$1 permanent;}
4. Reset the error page status code to 200 and return the specified content
Error_page 502404405500 / error;#error had better not have a suffix. Write an error.html before, and then want to return it to json. As a result, various settings do not work. Later, after working for a long time, we found that the pot location / error {default_type application/json; # add_header name value always;#always is an optional parameter. If this header already exists, it will not overwrite add_header Access-Control-Allow-Origin *. Return 200' {"code": 0, "msg": "your request cannot be processed temporarily", "more": $status}';} these are all the contents of the article "how to solve the problems encountered in nginx+uWsgi configuration". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.