Group: Member 
Post Group: Working Newbie
Posts: 64
Status: 
|
Some news:
I limited the concerned location to public root exclusively, adding an equal sign before "/". And it raised an error on "nginx -t" validation: it entered in conflict with a location block about PHP globally declared in /usr/local/apps/nginx/etc/conf.d/common:
Code # Pass the INDEX.PHP script to FastCGI server listening on 127.0.0.1:9178
location = / {
fastcgi_read_timeout 3600;
try_files $uri /index.php /index.html @maintenance;
fastcgi_pass unix:/usr/local/apps/php73/var/php73_9001.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}
Commenting this block above, my own below added for the subdomain as Extra Config, passed:
Code # pass requests to wsgi server
location = / {
proxy_set_header Host $http_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;
proxy_pass http://localhost:8000;
}
With this new location block, it works: when I navigate to http://test.mydomain.com, it well pass the request to the back-end WSGI server (Gunicorn) and the page computed by Python is well returned! So, good news, since the overall process works
But, but, I don't want to restrict the forwarding from Nginx to Gunicorn for the public root only. I would like to submit all requests to the underlying Gunicorn server as it should be to serve a WSGI-based app.
Why it doesn't work without the "=", despite the fact the "location / {}" block I showed in first pass is the one advised everywhere talking about Nginx as reverse proxy for a WSGI server serving a Python Flask app?
Also, should I uninstall PHP to prevent conflict, knowing I don't need PHP unless for phpMyAdmin and if Webuzo needs it?
So, what from this point?
How to redirect all requests to Gunicorn?
What do you think?
Good night (2:10 AM here)
----------------------- OpenVZ VPS, CentOS 7, Webuzo Premium / Desktop and full-stack dev w/ C, C++, Python, Perl, javascript... |