server deployment on debian and nginx

11 views
Skip to first unread message

Lucas

unread,
Dec 27, 2025, 12:57:26 PM (2 days ago) Dec 27
to py4web
hello one and all,

ok, I'm attempting to deploy on debian 13.2 trixie and nginx 1.26.3 with py4web working on port 8000, all brand new releases and versions.  so these work:

http://13.219.242.143:8000/_dashboard
http://13.219.242.143:8000/_documentation

where the latter throws 404 as it should.  so py4web is working nicely off of the port using a systemctl script essentially started via: 

ExecStart=/opt/python/bin/python /opt/python/bin/py4web run -H '0.0.0.0' -P '8000' -p '/opt/python/bin/password.txt' /opt/python/bin/apps

I'm trying to get nginx to serve the pages via port 80 right now, later 443.  so, my nginx config file looks like:

server {
  listen          80;
  server_name     $hostname;
  proxy_http_version 1.1;
  location / {
    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   Host $http_host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-Host $http_host;
    proxy_redirect off;
    proxy_set_header X-PY4WEB-APPNAME /_dashboard;
    proxy_pass http://127.0.0.1:8000/_dashboard$request_uri;
  }
  location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
    alias /opt/python/bin/apps/$1/static/$2;
    expires max;
  }
}

in the /etc/nginx/sites-available/dashboard.conf file with the appropriate symbolic link under sites-enabled folder.  and similar with documentation.conf file except replace "_dashboard" with "_documentation".

I just can not figure out a configuration of the two files to the two different apps where it consistently works for like:

where nginx is handing off to py4web's 8000 port.  

I see a lot of installing uwsgi for py4web but I thought we didn't need to do that if rocket/ombott is running off of port 8000?  maybe I'm wrong, not sure.  and what am I doing wrong on my nginx config files???

thank you in advance, lucas

Paul Ellis

unread,
Dec 27, 2025, 1:32:55 PM (2 days ago) Dec 27
to Lucas, py4web
Personally I use an nginx docker compose which has let's encrypt included with auto ssl certificate renewal. Just search on docker hub you'll find one. 

Then py4web in a docker container on the same network and everything is available externally via 443. Even though only port 80 is available from the py4web container. 

If this kind of setup interests you, let me know. 

--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/py4web/5302f4d5-d8e1-40d5-80c7-451367133092n%40googlegroups.com.

Massimo DiPierro

unread,
Dec 27, 2025, 11:59:56 PM (2 days ago) Dec 27
to Paul Ellis, Lucas, py4web
I think you need two differe location directives

location ~ ^/_dashboard/$ {
}


location ~ ^/_documentation/$ {
}

I did not try this myself.

Anyway I  recommend caddy over nginx. It will handle https certs automatically for you. It has simpler configs.


Christian Varas

unread,
Dec 28, 2025, 7:19:44 AM (18 hours ago) Dec 28
to Lucas, py4web
hi, try without “/_dashboard$request_uri”

proxy_pass      http://127.0.0.1:8000;


greetings 

--
Reply all
Reply to author
Forward
0 new messages