I have a flask application server.py
on a remote ubuntu server which I would like to deploy with uWSGI and reverse proxy it with nginx. However, I somehow cannot seem to get the configuration right as I also have an apache reverse proxy running to forward requests to another application instance running on the same server.
server.ini file for uWSGI config
[uwsgi]
module = server:app
master = true
processes = 4
enable-threads = true
socket = socket.sock
chmod-socket = 660
vacuum = true
die-on-term = true
config file for nginx
server {
listen 80;
server_name <domain-name-for-remote-server>;
location /form-server {
include uwsgi_params;
uwsgi_pass unix:/home/kafo/server/server.sock;
}
}
apache2 config file
<VirtualHost *:443>
ServerName <domain-name-for-remote-server>
ProxyRequests Off
ProxyVia Off
SSLEngine On
SSLCertificateFile /var/lib/r-cert/live/host:f:<domain-name-for-remote-server>.cert.pem
SSLCertificateKeyFile /var/lib/r-cert/live/host:f:otsvm1.<domain-name-for-remote-server>.pem
SSLCertificateChainFile /var/lib/r-cert/live/host:f:otsvm1.<domain-name-for-remote-server>.chain.pem
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://localhost:8090/
ProxyPassReverse / http://localhost:8090/
# Configuration for Flask app
ProxyPass /form-server http://127.0.0.1:5000/form-server
ProxyPassReverse /form-server http://127.0.0.1:5000/form-server
</VirtualHost>
<VirtualHost *:80>
ServerName <domain-name-for-remote-server>
Redirect Permanent / https://<domain-name-for-remote-server>/
</VirtualHost>
I get a port already in use conflict with this current configurations while trying to start both nginx and apache2
My idea here was to access the application instance over the URL https://<domain-name-for-remote-server>/
and the flask application over http://<domain-name-for-remote-server>/form-server
Reverse proxying and networking is really new for me and I would really appreciate any help here. Thanks!
Ryan Kafoor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.