8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

无法使用 NGINX 运行女服务员 (flask) 网络服务器

Edric 2月前

46 0

我一直在尝试使用 NGINX 在 ubuntu 上运行 flask 女服务员服务器。这是我当前的 NGINX 配置:服务器 { listen 80; server_name mydomain.com www.mydomain.com; client_max_body_...

我一直在尝试使用 NGINX 在 ubuntu 上运行 flask 女服务员服务器。

这是我当前的 NGINX 配置:

server {
    listen 80;
    server_name mydomain.com www.mydomain.com;

    client_max_body_size 64M;  # Adjust the size as needed
    large_client_header_buffers 4 32k;

    location / {
        proxy_pass http://127.0.0.1:80;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

以下是我的女服务员求职申请:

    def start(self):
        # Start the database instance
        self.db.start()
        # Set the DEBUG flag to False in production mode
        self.application.app.config["DEBUG"] = False
        # Store a reference to the application instance
        app_instance = self.application.app
        # If we are in production mode
        if self.prod:
            # Set the host to "0.0.0.0" (all network interfaces) and the port to 8080
            url = "127.0.0.1:80"
            # Print the URL that the application is running on
            print(f"Running PROD: http://{url}")
            # Start the application with Waitress, a production-ready WSGI server
            # The number of threads is set to 40
            self.register()
            waitress.serve(app_instance, listen=url, threads=10)
        else:
            # If we are in development mode
            print("Running DEV")
            # Run the application with its built-in development server
            # The host is set to "0.0.0.0" (all network interfaces), the port is 8080,
            # and debug mode is enabled
            self.register()
            self.application.run(host="127.0.0.1", port=80, debug=True,url_scheme='https', threaded=True)

我遇到的问题是,网页之前返回错误 400 标头大小问题,因此我指定了一个 large_client_header_buffers 对象,现在它似乎不断返回错误 500。

nginx 的最新日志如下:

2024/06/21 20:15:03 [alert] 2935#2935: *48088 socket() failed (24: Too many open files) while connecting to upstream, client: 127.0.0.1, server: mydomain.com, request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:80/", host: "mydomain.com"

我已经将 flask 应用程序设置为在系统启动时在 crontab 上运行,并且 NGINX 也会在启动时启动。

任何帮助都将不胜感激!

帖子版权声明 1、本帖标题:无法使用 NGINX 运行女服务员 (flask) 网络服务器
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由Edric在本站《ubuntu》版块原创发布, 转载请注明出处!
最新回复 (0)
  • 我对此很陌生,所以我不太清楚我做了什么。我运行了这些命令:\' make -j $(nproc)\' 然后 \' sudo cp -f arch/x86/boot/bzImage / boot/vmlinuz-4.15.18-custom\' 最后 \'sudo reboot\'

返回
作者最近主题: