Cutting the long story short, I really appreciate it if someone could
point me to a complete guide for nginx deployment, or writhe one :)
server {Is this enough for you? If people really feel it is useful I could write a guide for nginx deployment, but give me some time! :)
listen 443;
ssl on;
ssl_certificate /etc/ssl/nginx/nginx.pem;
ssl_certificate_key /etc/ssl/nginx/nginx.key;
keepalive_timeout 70;
server_name my.server.name;
access_log /var/log/nginx/web2py.access.log;
location / {
set $fixed_destination $http_destination;
if ($http_destination ~* ^https(.*)$)
{
set $fixed_destination http$1;
}
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Destination $fixed_destination;
}
However, don't you have to run nginx behind apache or another server?
However, don't you have to run nginx behind apache or another server?
PYTHONPATH=/var/web2py #your path to web2py MODULE=wsgihandler
If anyone has an tips, suggestions or corrections, please let me know. I am relatively new to all of this.
However;
When I run web2py with nginx I use the fastcgi module;
I configure nginx like described in the stackoverflow article;
except I use fastcgi;
In nginx config I have
location / {
include fascgi_params;
fastcgi_pass unix:/tmp/fcgi.sock
}
then go to web2py root and run the python fastcgihandler.py script;
The caveat is that you have to change the permissions on the
/tmp/fcgi.sock file because when web2py runs it; its run under the user
that started the process;
so you do
chown nginx:nginx /tmp/fcgi.sock
and then your done;
You wont get and 502 errors or anything; its really quite simple;
I am not sure if the uwsgi implementation is better as I am trying that
tonight; but fastcgi has be running very stable for the past few months.
I apologize for the lack of detailed instructions (I am not in front of
the configs) but if you have any questions I can look into it further
and try to help.
Thanks.