Can I use the uwsgi protocol to call http?

前端 未结 3 1621
自闭症患者
自闭症患者 2020-12-21 16:47

Here\'s a data flow: http <--> nginx <--> uWSGI <--> python webapp

I guess there\'s http2uwsgi transfer in nginx, and uwsgi2http in uWSGI.

What if I

3条回答
  •  太阳男子
    2020-12-21 16:57

    From your question I'm assuming, you want to directly run your WSGI-compliant app with uWSGI and open an HTTP-Socket. You can do so by configuring your uwsgi.ini (or whatever the filename is) with

    http=127.0.0.1:8080
    

    uwsgi will now open an HTTP-socket that listen on port 8080 for incoming connections from localhost (see documentation: http://uwsgi-docs.readthedocs.org/en/latest/HTTP.html)

    Alternatively you can directly start your process from the command-line with the http-parameter:

    $ uwsgi --http=127.0.0.1:8080 --module=yourapp:wsgi_entry_point
    

    If you use unix-sockets to configure uwsgi nginx is able to communicate with that socket via the uwsgi-protocol (http://uwsgi-docs.readthedocs.org/en/latest/Protocol.html).

    Keep in mind, that if you usually serve static content (css, javascript, images) through nginx you will need to set that up, too, if you run uwsgi directly. But if you only want to test a REST-API this should work out for you.

提交回复
热议问题