Reputation: 21
Hello I am running web2py nginx and uwsgi but I am running into an issue deploying 1 or more domains. The issue is the server is always returning the default welcome application and not the folder I specify for a domain
Any ideas are greatly appreciated. Here is my nginx.conf file (the relevant parts)
server {
listen 80;
server_name www.cheer10s.com cheer10s.com;
location / {
uwsgi_pass 127.0.0.1:9001;
include uwsgi_params;
}
location /static {
root /opt/web2py/applications/cheer10s/;
}
}
server {
listen 443;
server_name www.cheer10s.com cheer10s.com;
ssl on;
ssl_certificate /opt/nginx/conf/server.crt;
ssl_certificate_key /opt/nginx/conf/server.key;
location / {
uwsgi_pass 127.0.0.1:9001;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
}
location /static {
root /opt/web2py/applications/cheer10s/;
}
}
*cheers
Upvotes: 2
Views: 1591
Reputation: 8168
This location:
location /static {
root /opt/web2py/applications/cheer10s/;
}
is only a rewrite for static files, not for apps, and I guess it is wrong, must be:
location ~* /(\w+)/static/ {
root /opt/web2py/applications/;
}
The line above will just server files under /static folder directly by NGINX do not touching web2py for it.
with uwsgi, this lines are responsible to call web2py
location / {
uwsgi_pass 127.0.0.1:9001;
include uwsgi_params;
}
and the router must be defined in the framework, not in nginx. if you want to cheer10s to be the default application, place routes.py in your web2py root folder. looking like this:
routers = dict(
# base router
BASE = dict(
default_application = 'cheer10s',
domains = {
'yourdomain.com' : 'cheer10s',
'anotherdomain.com':'anotherapp'
},
applications = ['cheer10s','anotherapp','admin'],
controllers = 'DEFAULT'
),
)
save the content above as routes.py in web2py root folder and restart web2py, but dont forget to fix your nginx conf.
Upvotes: 3