On 2024-08-31 22:11:42, Kirill Miazine wrote:
> a more complete example, with getting rid of any stale sockets and
> using more suitable permissions:
> 
> #!/usr/local/bin/python3
> 
> from flask import Flask
> app = Flask(__name__)
> # more flask stuff here
> 
> if __name__ == '__main__':
>     from flup.server.fcgi import WSGIServer
>     sock = pathlib.Path('/var/www/run/wwwrun/foo.sock').resolve()
>     try:
>         sock.unlink()
>     except:
>         pass
>     WSGIServer(app, bindAddress=str(sock), umask=0o007).run()
> 
> make sure that the python scripts is run as a daemon when the system
> starts.
> 
> note that the script will not run in a chroot, but have access to the
> entire system, not just what is present in /var/www. beware.
> 
> > If you're usign a UNIX-domain socket, you have to put it somewhere
> > inside the /var/www chroot; for example
> > /var/www/run/<your-app>/fcgi.sock and then instructs httpd to talk
> > to it
> > 
> >     fastcgi {
> >             # note that this is relative to the /var/www chroot
> >             socket "/run/<your-app>/fcgi.sock"
> >     }

That worked! Thank you all very much for the help.

-- 
Sadeep Madurange
PGP: 103BF9E3E750BF7E

Reply via email to