I successfully managed to install: NGINX + uWSGI + Flask on a CentOS 6.x server
but I still have some doubts in terms of configuration:
1) I am running NGINX as a service: service nginx start/stop/restart
if I type "ps aux | grep nginx", I can see 2 processes:
- (by user root) master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
- (by user nginx) worker process
is that OK?
2) I setup a virtualenv for Flask and installed the uWSGI package under such virtualenv.
Currenty I am starting the uWSGI manually by typing "uwsgi /somedir/uwsgi.ini", where uwsgi.ini is as follows:
chdir = /myappdir
uid = pyuser
chmod-socket = 666
socket = /tmp/uwsgi.sock
module = run
callable = app
virtualenv = /myappdir/myvirtualenv
Is it possible to start uWSGI as a service, similarly to NGINX (as described at point 1) ? Is such case should the user be root or non-root?
3) When I start the uWSGI, I am currently getting the following warning:
*** Python threads support is disabled. You can enable it with --enable-threads ***
I realized that in the "uwsgi.ini" configuration file you can also configure a number of processes and threads. Considering the server I am running has just 1 core, can I set up multiple processes and threads? and if so, how many?
3b) On the NGINX configuration file "/etc/nginx/nginx.conf" it is also possible to specify "worker_processes", which by default are 1. Can I increase that, or it can be higher than 1 only for multicore servers?
4) Beside the threads support disabled, when I start the uWSGI I also get these warnings. What do they mean?
*** WARNING: you are running uWSGI without its master process manager ***
*** Operational MODE: single process ***
*** uWSGI is running in multiple interpreter mode ***