<div dir="ltr">Well, I found Nginx logs in /var/log/nginx, which is great. Nginx is now working. I found UWSGI logs, too, but the only file in the folder is empty. UWSGI refuses to start, and I don't get why. The only log file is empty, and systemcpl status uwsgi.service doesn't really tell me anything. Anyone seen UWSGI do this? Any idea where it puts log files that will explain the problem? Thanks!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 5, 2016 at 1:56 PM, Alex Hall <span dir="ltr"><<a href="mailto:ahall@autodist.com" target="_blank">ahall@autodist.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Thanks for the answers!<br><br></div>At the risk of going a bit off topic, I made my Nginx and UWSGI configuration files according to this guide:<br><a href="http://www.markjberger.com/flask-with-virtualenv-uwsgi-nginx/" target="_blank">http://www.markjberger.com/flask-with-virtualenv-uwsgi-nginx/</a><br><br></div>But am now seeing both applications fail to start. They offer only "See systemctl status or journalctl" as a way to view the problem, but those just tell me there was an exit code of 1. There's no "error in this file on this line" or anything helpful. Is there a way to see exactly what's wrong? I know it'll be some small syntax problem in one of the files, since I had to write them by hand over SSH rather than pasting.<br></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Thu, May 5, 2016 at 1:30 PM, Anthony Ford <span dir="ltr"><<a href="mailto:ford.anthonyj@gmail.com" target="_blank">ford.anthonyj@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Hey Alex,<div><br></div><div>Congrats on the progress so far. Let me see if I can clarify some things for you</div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>1. Is Mod_WSGI only for Apache? Should I stick with UWSGI, given that I'm using Nginx?</div></div></blockquote><div><br></div></span><div>Yes. Mod_WSGI is essentially a router that passes the request from Apache (the url requested, HTTP headers,  etc), and will accept the response from your app and pass it back to Apache to send to the client. If you are using Nginx, yes you should stick with uWSGI. </div><span><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>2. I read that UWSGI is also a web server, and that it's suggested to use UWSGI with Nginx behind it. This seems more complicated than I expected. Did I understand it right? Is this a choice, or the only/best way to set things up?<br></div></blockquote><div><br></div></span><div>uWSGI can act as a standalone web-server for HTTP/S (<a href="http://uwsgi-docs.readthedocs.io/en/latest/HTTP.html#the-uwsgi-http-https-router" target="_blank">http://uwsgi-docs.readthedocs.io/en/latest/HTTP.html#the-uwsgi-http-https-router</a>). If you have a heavy site (i.e. hundreds+ of active users), you will waste efficiency and capacity by having uWSGI handle your static files (i.e. your JS, images, etc.), so it is recommended to hide uWSGI behind an HTTP server (i.e. Nginx) and let it handle the static loads since they are significantly better at serving static files.</div><div><br></div><div>No, you do not have to do this if you are building an internal or low use site (but if the site is public, be prepared for traffic spikes that can bring your site down, like slash-doting or reddit hug-of-deaths). Use the `--http` option as suggesting in the above link.</div><span><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div></div>3. When all this is up and running, will views be relative to my app, or app/templates? That is, should I set the document root in Nginx to be /var/www/myApp, or /var/www/myApp/templates? The myApp folder has run.py, config.py, static/, and templates/.</blockquote><div><br></div></span><div>If you are serving your app behind Nginx, the main document root (or location in nginx parlance), i.e. /, would be your app in wsgi (the uwsgi_pass section). The only thing Nginx should serve would be your static files in `static/` (which should be served as `/static/`. </div><div><br></div><div>I've stuck together a gist with some sanitized config files from a recent project. You can find them here: <a href="https://gist.github.com/ajford/32ca09c1bdb67e2211247f189aa2ae9a" target="_blank">https://gist.github.com/ajford/32ca09c1bdb67e2211247f189aa2ae9a</a></div><div><br></div><div>It's got some complexity (the vars in the wsgi definitions) because this was running on an applications server with three different Flask based apps running behind Nginx. In my case, while the number of users was low (~10 max, more like a single user concurrent), I only had the one server available, so they were placed behind Nginx to handle the virtual server names (so the different apps wouldn't crash when serving). This may be possible using uwsgi stand-alone, but I already knew how to do it in Nginx.</div><div><br></div><div>Hope this helps!</div></div><span><font color="#888888"><br><br><br clear="all"><div><div><div dir="ltr">Anthony Ford,<br>KF5IBN,<div><a href="mailto:ford.anthonyj@gmail.com" target="_blank">ford.anthonyj@gmail.com</a></div></div></div></div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><br></div></div><span class="">-- <br><div><div dir="ltr"><div><div>Alex Hall<br></div>Automatic Distributors, IT department<br></div><a href="mailto:ahall@autodist.com" target="_blank">ahall@autodist.com</a><br></div></div>
</span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div>Alex Hall<br></div>Automatic Distributors, IT department<br></div><a href="mailto:ahall@autodist.com" target="_blank">ahall@autodist.com</a><br></div></div>
</div>