I tried using nginx-unit on mac before, but after studying python, I made a simple Webapp with flask. You can use uWSGI, but I thought I'd try it with the nginx-unit I used before, so I tried it again.
-It is now available in Homebrew.
So, I'll erase what I put in from the source before.
$ make uninstall
In the source folder.
Then install as official https://unit.nginx.org/installation/#homebrew
By the way, when installing with Homebrew, there are / var and / tmp below / usr / local /
.
So, the socket for unitd config
/usr/local/var/run/unit/control.sock
It is in.
Similarly, the log file
/usr/local/var/log/unit/unit.log
(/var/log/unit/unit.log
for Linux)
Will be made in.
In addition, if you have changed the location of the packages installed by homebrew,
brew --prefix
You should check with.
If you get the above error and are not sure, look at the log. (I had trouble investigating the cause without knowing the location of the above log file ...)
Whether it is an error around Python or a problem with how to write json is coming out in detail. ↓ As an example
2020/08/20 23:19:03 [notice] 89400#2700292 process 89405 exited with code 1
2020/08/20 23:19:03 [warn] 89404#2700311 failed to start application "flask_app"
2020/08/20 23:19:03 [alert] 89404#2700311 failed to apply new conf
2020/08/20 23:19:03 [alert] 89403#2700310 failed to apply previous configuration
2020/08/20 23:19:07 [info] 89410#2700380 "flask_app" application started
2020/08/20 23:19:07 [alert] 89410#2700380 Python failed to import module "views"
It came out properly like this.
config.json for flask https://unit.nginx.org/howto/flask/ Again, it's faster to look at the formula. The point to note
Mind that Unit will look for an application callable in the WSGI module.
Here, please note that it will not work if you use app or something.
With nginx-unit, you can run multiple apps, which is convenient. Next, I will try to coexist with ruby. (I want to use it with docker)