1

Coming from the Linux environment, I'll try to be as accurate as possible with Windows concepts I clearly don't master.

Here's my current situation:

  • I have a functional Windows (10 pro x64) Nginx setup
  • It's working well on https, using the computer name as FQDN (static files are reachable through https://computer-name/filenames)
  • My Python Flask app works well and can be served standalone or as WSGI thanks to waitress.

And here's my problem:

I can't figure out how -and if it's even possible- to bind my WSGI app to the server configuration of Nginx. Considering the well written Digital Ocean tutorial for Linux, my problem is probably somewhere between steps 5 and 6. Should I apply the same way of thinking and build a Windows service before linking it thanks to a .sock link, or is that clearly not the right way?

If that's the right way, I don't know where to learn how to do that and what are the main steps to achieve that. For example, it seems that UNIX sockets are now supported by Windows (but I don't know how) or should I use named pipes (but... I don't know how!).

Hopping that I miss nothing, thanks your help.

Edit:

Inspired of this question configuring a proxy pass works. Is that a solid solution?

2
  • JFYI nginx on windows should NOT be used for production. “high performance and scalability should not be expected”, “… is considered to be a beta version” – Alexey Ten May 3 '19 at 7:29
  • May my customer hear you! That's not efficient and the efforts to deploy it are huge. BTW, it's more a proof of concept than a widely deployed app. – Glandalf313 May 3 '19 at 9:20
2

According to Waitress Documentation:

unix_socket Path of Unix socket (string). If a socket path is specified, a Unix domain socket is made instead of the usual inet domain socket.

Not available on Windows.

Instead of running it from a named pipe you can run it in a local port and reverse proxy that port with nginx. So instead of following DigitalOcean article's step 6 you can do this:

location / {
    proxy_pass http://127.0.0.1:8000;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $host:$server_port;
    proxy_set_header X-Forwarded-Port $server_port;
}

And you can add the waitress serve command to Windows scheduled tasks, see here.


Hope this helps.

1
  • Seems to be a really clear & efficient solution. Thanks. The schedule task tip will help too. – Glandalf313 May 2 '19 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.