gunicorn + nginx: Server via socket or proxy?

后端 未结 5 1259
春和景丽
春和景丽 2021-01-30 08:46

I\'ve seen two strategies for hosting a django application with gunicorn and nginx.

One strategy is to run gunicorn on a network port. For example (from http://goodcode

5条回答
  •  猫巷女王i
    2021-01-30 09:44

    I know I'm late to this party, bit this may be of use, if you are trying to get this to work on Red Hat flavour Linux with SELinux enforcing.

    It gets in the way badly if you try to use sockets. I gave up.

    It also gets in the way if you try to bind Gunicorn via an arbitrary TCP Port. By default (on Centos 1708) there is a subset of ports which SELinux is happy for you to use: 80,81,443,488,8008,8009,8443,9000

    I went with 8009 but apparently for some other port you can use

    semanage -a -t http_port_t -p tcp $PORTNUMBER

    and to see the list of ports

    semanage port -l

提交回复
热议问题