0

I'm trying to deploy my flask web app using lighttpd. I created this hello.fcgi file

#!/usr/bin/python
from flup.server.fcgi import WSGIServer
from hello import app

if __name__ == '__main__':
    WSGIServer(app).run()

And python file is hello.py

I added these lines at the end of the /etc/lighttpd/lighttpd.conf. I wanted it to be accessible from http://localhost:7777.

$SERVER["socket"] == ":7777" {
    fastcgi.server = ("/hello.fcgi" =>
        ((
            "socket" => "/tmp/hello-fcgi.sock",
            "bin-path" => "/var/www/html/py/hello.fcgi",
            "check-local" => "disable",
            "max-procs" => 1
        ))
    )

    alias.url = (
        "/static/" => "/var/www/html/py/static"
    )

    url.rewrite-once = (
        "^(/static($|/.*))$" => "$1",
        "^(/.*)$" => "/hello.fcgi$1"
    )
}

I also enabled enable the FastCGI, alias and rewrite modules. All the files of my web app is located inside /var/www/html/py/ folder including hello.py , hello.fcgi and the "static" folder.

Then I restarted lighttpd and tried to visit http://localhost:7777 but my browser says "This site can’t be reached".

What is wrong here and how can I fix it?

migrated from webmasters.stackexchange.com Apr 18 at 0:26

This question came from our site for pro webmasters.

  • I don't use lighttpd but have you tried accessing it using http://127.0.0.1 rather than localhost? because generally, websites use virtual hosts to determine what the website should be accessible on which is different than 'listening' on all interfaces (IP addresses). – Simon Hayter Apr 17 at 14:34
  • @SimonHayter Just tried http://127.0.0.1:7777 , stll not working – user8481790 Apr 17 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.