get django/lighttpd "hello world" page

56 views
Skip to first unread message

Phil

unread,
Jul 18, 2011, 3:29:03 PM7/18/11
to Django users
Hi,

I have an ubuntu server, django is fully installed and working,
lighttpd is installed and working(works with standard html page), but
I am not sure how to get them talking to each other?

It is my first time putting a django site onto a live server so any
help is appreciated. I'm used to a php "stick everything into webroot"
setup.

I have the following in my lighttpd.conf file as mentioned on django
website....

server.document-root = "/var/www"
fastcgi.server = (
"/mysite.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
"host" => "my ip address",
"port" => 80,
#"socket" => "/home/user/mysite.sock",
"check-local" => "disable",
)
),
)


At present all that is doing is loading my html page in my webroot. I
have restarted lighttpd and all. But not sure how it see's django
project?

Thanks.

Daniel Roseman

unread,
Jul 18, 2011, 5:41:07 PM7/18/11
to django...@googlegroups.com
Op maandag 18 juli 2011 20:29:03 UTC+1 schreef Phil het volgende:
See the very good documentation on FastCGI setup:
- it even has a section specifically on lighttpd. 
--
DR.

Phil

unread,
Jul 18, 2011, 5:55:46 PM7/18/11
to Django users
Thanks for reply. Yeah I seen that, I did run "./manage.py runfcgi
method=threaded host=my ip address port=80" in my mysite directory but
am still getting a "not found" page.

Javier Guerra Giraldez

unread,
Jul 18, 2011, 5:59:01 PM7/18/11
to django...@googlegroups.com
On Mon, Jul 18, 2011 at 4:55 PM, Phil <phi...@gmail.com> wrote:
> I did run "./manage.py runfcgi
> method=threaded host=my ip address port=80"

don't use port 80 for FastCGI. chances are that it's already used

--
Javier

Phil

unread,
Jul 20, 2011, 2:42:10 PM7/20/11
to Django users
if I can get a standard HTML to display on port 80 with lighttpd does
that still mean I have to use a different port for fcgi?

On Jul 18, 10:59 pm, Javier Guerra Giraldez <jav...@guerrag.com>
wrote:

Javier Guerra Giraldez

unread,
Jul 20, 2011, 2:52:34 PM7/20/11
to django...@googlegroups.com
On Wed, Jul 20, 2011 at 1:42 PM, Phil <phi...@gmail.com> wrote:
> if I can get a standard HTML to display on port 80 with lighttpd does
> that still mean I have to use a different port for fcgi?

absolutely.

the port used between the webserver and webapp must _not_ be the same
where the browsers connect to the webserver.

--
Javier

Phil

unread,
Jul 20, 2011, 3:02:17 PM7/20/11
to Django users
thanks Javier! I switched it to port 8080 now.

I have a "lighttpd/lighttpd.conf" with the following...

server.document-root = "/var/www"

$HTTP["host"] =~ "(^|\.)mydomain\.com$" {
fastcgi.server = (
"/var/www/mydomain.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
"host" => "my ip address",
"port" => 8080,
#"socket" => "/home/user/mysite.sock",
#"check-local" => "disable",
)
),
)
}


But I also have a "lighttpd/conf-enabled/10-fastcgi.conf" file with
the following....

server.modules += ( "mod_fastcgi" )

$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( ".py" => "/usr/bin/python" )
}

## Warning this represents a security risk, as it allow to execute any
file
## with a .pl/.php/.py even outside of /usr/lib/cgi-bin.
#
cgi.assign = (
# ".pl" => "/usr/bin/perl",
# ".php" => "/usr/bin/php-cgi",
".py" => "/usr/bin/python",
)


Do I have the correct code in the right place or am I missing
something out?


On Jul 20, 7:52 pm, Javier Guerra Giraldez <jav...@guerrag.com> wrote:

Javier Guerra Giraldez

unread,
Jul 20, 2011, 3:13:53 PM7/20/11
to django...@googlegroups.com
On Wed, Jul 20, 2011 at 2:02 PM, Phil <phi...@gmail.com> wrote:
>            "host" => "my ip address",

sometimes flup (and other fastcgi launchers) bind only to the
127.0.0.1 IP. if you want to put the webserver and webapp on
different machines, be sure to bind to all IPs (typically setting "0"
as IP on the launcher). if both webserver and webapp are on the same
machine, faster and safer is to use 127.0.0.1 (and even faster and
safer is to use socket files)

--
Javier

Phil

unread,
Jul 20, 2011, 3:41:15 PM7/20/11
to Django users
thanks Javier.

On Jul 20, 8:13 pm, Javier Guerra Giraldez <jav...@guerrag.com> wrote:
Reply all
Reply to author
Forward
0 new messages