Linux – Uwsgi and flask with unix socket instead of URL

debianflasklinuxpythonsocket

I was trying to find out the difference between a socket as a unix file and a socket that is a ip and port.

If I switch something like uwsgi to use a file instead of a port and ip, how do I then access uwsgi as a URL in my browser, since no port is now specified for my flask application.

Best Answer

You can run uwsgi to listen to a TCP/IP port, for example uwsgi --http :80 , if you change it to listen to a Unix socket (for ex: uwsgi --socket :8000 ) then as you said, this is local only, no web service (TCP/IP) is exposed to the Internet and you have to put a web server like nginx in front of uwsgi as 'proxy' that can get the http requests from the outside world (see https://gist.github.com/evildmp/3094281 for a django example instead of Flask)