This may help!
server {
listen 80;
return 301 https://appname.domain.med$request_uri; #
http://wiki.nginx.org/Pitfalls#Taxing_Rewrites
charset utf-8;
server_name $hostname;
root /var/www;
access_log /var/log/nginx/yoursite.access.log;
error_log /var/log/nginx/yoursite.error.log;
#to enable correct use of response.static_version
#location ~* /(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
# alias /home/www-data/web2py/applications/$1/static/$2;
# expires max;
#}
location ~* /(\w+)/static/ {
root /home/www-data/web2py/applications/;
#remove next comment on production
#expires max;
}
location ~^\/(?!redmine(.*)) {
#uwsgi_pass 127.0.0.1:9001;
uwsgi_pass unix:///tmp/web2py.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://unicorn_server;
break;
}
}
}
server {
listen 443 default_server ssl;
charset utf-8;
server_name $hostname;
root /var/www;
ssl_certificate /etc/nginx/ssl/self_signed.cert;
ssl_certificate_key /etc/nginx/ssl/self_signed.key;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_ciphers
ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
ssl_protocols SSLv3 TLSv1;
keepalive_timeout 70;
location ~^\/(?!redmine(.*)|formation(.*)) {
#uwsgi_pass 127.0.0.1:9001;
uwsgi_pass unix:///tmp/web2py.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://unicorn_server;
break;
}
}
}
Richard
On Fri, Oct 4, 2013 at 2:24 PM, Gour <[email protected]> wrote:
> On Fri, 4 Oct 2013 10:45:13 -0700 (PDT)
> LightDot <[email protected]> wrote:
>
> > Couple of things I don't understand - are you using anyserver.py or
> > not?
>
> No.
>
> > Are you using nginx in front of gunicorn, or..?
>
> Yes, nginx is used as reverse proxy.
>
> > Please post your relevant config files and full startup lines.
>
> Here is ~/nginx/conf/sites/web2py:
>
> upstream gunicorn.web2py {
> server unix:/home/somepath/virtualenvs/web2py/web2py.sock;
> }
>
> server {
> listen 127.0.0.1:somelocalport;
> server_name my.domain.com;
>
> location / {
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header Host $http_host;
> proxy_redirect off;
> if (!-f $request_filename) {
> proxy_pass http://gunicorn.web2py;
> break;
> }
> }
>
> }
>
> and here is part of gunicorn init script:
>
> #!/bin/sh
> ### BEGIN INIT INFO
> # Provides:
> # Required-Start: $local_fs $syslog
> # Required-Stop: $local_fs $syslog
> # Default-Start: 2 3 4 5
> # Default-Stop: 0 1 6
> # Short-Description: Gunicorn processes
> ### END INIT INFO
>
> NAME="web2py"
> PROJECT_DIR="$HOME/virtualenvs/$NAME"
> PYTHONPATH="$PROJECT_DIR/web2py"
>
> PIDFILE="$PROJECT_DIR/$NAME.pid"
> SOCKET="$PROJECT_DIR/$NAME.sock"
> DAEMON=$PROJECT_DIR/bin/gunicorn
> PATH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH
> OPTS="-D -b unix:///$SOCKET --worker-class sync --pid $PIDFILE
> --pythonpath $PYTHONPATH --chdir $PYTHONPATH wsgihandler --preload"
> WORKERS=1
>
>
> start()
> {
> printf "Starting $NAME "
> export PYTHONPATH=$PYTHONPATH;
> cd $PROJECT_DIR;
> $DAEMON $OPTS && echo "OK" || echo "failed";
> }
>
>
> [...]
>
>
> Let me repeat that now it works, but I wonder why it didn't work without
> having parameters_80.py file present in PROJECT_DIR/web2py ?
>
>
> Sincerely,
> Gour
>
> --
> As the ignorant perform their duties with attachment to results,
> the learned may similarly act, but without attachment, for the
> sake of leading people on the right path.
>
> http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
>
> --
> The embodied soul may be restricted from sense enjoyment,
> though the taste for sense objects remains. But, ceasing
> such engagements by experiencing a higher taste,
> he is fixed in consciousness.
>
> http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.