uHTTPd cgi serving small cherrypy website

Im strugling configuring the proxy to my small cherrypy website.
My cgi is configured as i can get to this sample laying in /www/cgi-bin/test.py when entering mydevice.local/cgi-bin/test.py

print "Content-type:text/html\r\n\r\n"
print '<html>'
print '<head>'
print '<title>Hello Word - First CGI Program</title>'
print '</head>'
print '<body>'
print '<h2>Hello Word! This is my first CGI program</h2>'
print '</body>'
print '</html>'

then i tried this:

I followed the best resource i cold find: on digitalocean
for testing i used this wsgi.py:

def application(env, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    return ["Hello!"]

and server.py:

# Import your application as:
# from wsgi import application
# Example:

from wsgi import application

# Import CherryPy
import cherrypy

if __name__ == '__main__':

    # Mount the application
    cherrypy.tree.graft(application, "/")

    # Unsubscribe the default server

    # Instantiate a new server object
    server = cherrypy._cpserver.Server()

    # Configure the server object
    server.socket_host = ""
    server.socket_port = 8080
    server.thread_pool = 30



obvious there is something missing here, i do not see how to stich it together...

That second code example looks like it implements an independent HTTP server running on port 8080. I am not sure how either Ngix or uhttpd fit into the equation here. What are you trying to achieve?

Oh, thats maybe why i dont understand how to connect it together.

Im trying to use the uHTTPd server that already hosts my luci app to serve a cherrypy website by using cgi. The luci is working and linked under www/cgi-bin/luci and is setup to display when i go to devicename.local now i woul like to add a path like devicename.local/mysite

Is it more clear what im trying to do?

Yeah, I understand now. So the problem is that uhttpd does not support reverse proxying (which is what this DigitalOcean recipe is implementing).

You've three choices more or less:

  1. Run the CherryPy framework as CGI, as outlined here: https://github.com/cherrypy/tools/blob/master/RunAsCGI
  2. Disable uhttpd and use the CherryPy CGI server to serve your Cherry scripts + LuCI: https://pypi.org/project/cherrypy-cgiserver/ (register a /cgi-bin/luci/ path which maps extension "luci" (without dot) to /www/cgi-bin/luci)
  3. Move uhttpd to another port (e.g. 8080), install lighttpd, nginx or apache and configure a reverse proxy from /cgi-bin/luci/ to