Python + PHP + Lighttpd?

I've set up a few web servers in my day, but I'm not sure how they work internally. I'm setting up a new environment for myself and I'm interested in configuring my lighttpd server to support both PHP and Python. Is this possible?


Asked by: Daisy157 | Posted: 06-12-2021






Answer 1

Yes, this is possible. Here you can find a sample configuration.

fastcgi.server = (
".php" => ((
"bin-path" => "/usr/bin/php5-cgi",
"socket" => "/tmp/php.socket"
)),
"django.fcgi" => (
"main" => (
"host" => "127.0.0.1",
"port" => 9090, #set the port numbers to what-eva you want
),
),
"admin.fcgi" => (
"admin" => (
"host" => "127.0.0.1",
"port" => 9091,
)
)
)

Answered by: Chloe915 | Posted: 07-01-2022



Answer 2

You can also enable Lighty to use .pl, .py and .php as 'cgi' by enabling mod_cgi and setting it up. The default configs are on the Lighty website. However, this will have the benefits and problems of running an independent cgi process. If you are only experiencing light traffic, performance shouldn't be an issue.

Answered by: Chelsea303 | Posted: 07-01-2022



Similar questions

python - Django lighttpd FCGI error

I am trying to deploy my django app via lighttpd + fcgi, but when I run the fcgi script, it gives me an error Here's the fcgi script itself: #!/usr/bin/python2.6 import sys, os # Add a custom Python path. sys.path.insert(0, "/home/wite") # Switch to the directory of your project. (Optional.) os.chdir("/home/wite/dormcode") # Set the DJANGO_SETTINGS_MODULE environment variable. os.environ['DJANGO_...


python - Setup gevent with Lighttpd, weird stuff

I have wary odd problem. I configured Lighttpd to pass /test to fastcgi backend. just added this in config fastcgi.server = ("/test" => ("127.0.0.1" => ( "host" => "127.0.0.1", "port" => 7101, "docroot" => "/", "check-local" => "disable" ) ) ) Now, when i start flup example, and hit 127.0.0.1:80/test everything work fine. Tested uWSGI t...


python - php and django on the same lighttpd server

I have working lighttpd + django server but i wanna php too for example: www.mydomian.com is django homepage and www.mydomian.com/owncloud is owncloud distribution. Is posible to do that? Really sorry for my terrible english ;) And here is my lighttpd.conf server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_rewrite", ) server.document-root = "/v...


php - lighttpd run python script as root

I'm trying execute a python script from php function shell_exec(), but this script require root privileges. The python code is very simple. Using libraries wifi python does a scan of all the SSID and provides in output the information on the various wireless networks to which he had a scan in JSON format. WiFi libraries are scanning using iwlist that requires root privileges. If it is performed by a user who does ...


python - Not able to run django with lighttpd

I am learning Django and configuring Lighttpd as web server. My Lighttpd Server Configuration for running Django is like below server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_scgi", "mod_proxy", ) server.document-root = "/var/www/html" server....


logging - From a python cgi can I write to Lighttpd log file?

I have a python cgi script (just python, I didn't use any framework). It's served using Lighttpd on openSUSE. I would like to redirect my logging statements (like logging.info and so on) to be included to Lighttpd log file. If this can't be done, how can I create my own log file?


python - Django lighttpd FCGI error

I am trying to deploy my django app via lighttpd + fcgi, but when I run the fcgi script, it gives me an error Here's the fcgi script itself: #!/usr/bin/python2.6 import sys, os # Add a custom Python path. sys.path.insert(0, "/home/wite") # Switch to the directory of your project. (Optional.) os.chdir("/home/wite/dormcode") # Set the DJANGO_SETTINGS_MODULE environment variable. os.environ['DJANGO_...


lighttpd - How do I enable external access to a python fcgi app?

I have a simple web app which displays a simple hello world. I can access the app through the web browser (127.0.0.1:3000/test/hello), but cannot access it using the local ip the app is running on, or using my external ip (i have forwarded the port appropriately on my router). server.modules += ( "mod_fastcgi" ) server.document-root = "/Users/me/test" server.port = 3000 server.bind = "127.0.0...


How to debug Python running on a local lighttpd server using Python Tools for Visual Studio (PTVS)

Visual Studio has great python support via the Python Tools for Visual Studio: http://pytools.codeplex.com/ Debugging python code in Visual Studio works as expected. I set up a lighttpd server on my local Windows machine, and I have python scripts running as cgi scripts. I would like to be able to debug these in Visual Studio (running on the same ...


python - Setup gevent with Lighttpd, weird stuff

I have wary odd problem. I configured Lighttpd to pass /test to fastcgi backend. just added this in config fastcgi.server = ("/test" => ("127.0.0.1" => ( "host" => "127.0.0.1", "port" => 7101, "docroot" => "/", "check-local" => "disable" ) ) ) Now, when i start flup example, and hit 127.0.0.1:80/test everything work fine. Tested uWSGI t...


Lighttpd + fastcgi + python (for django) slow on first request

I'm having a problem with a django website I host with lighttpd + fastcgi. It works great but it seems that the first request always takes up to 3seconds. Subsequent requests are much faster (<1s). I activated access logs in lighttpd in order to track the issue. But I'm kind of stuck. Here are logs where I 'lose' 4s (from 10:04:17 to 10:04:21): 2012-12-01 10:04:17: (mod_fastcgi.c.3636) h...


cgi - Running python scripts from lighttpd - Firefox asking to save file

I am trying to run a simple Python script from my lighttpd server. The HTML code is: <html> <title>Interactive page</title> <body> <form method=POST action="cgi-bin/cgi101.py"> <P><B>Entery your name: </B> <P><input type=text name=user> <P><input type=submit> </form> </body> </html>


python - php and django on the same lighttpd server

I have working lighttpd + django server but i wanna php too for example: www.mydomian.com is django homepage and www.mydomian.com/owncloud is owncloud distribution. Is posible to do that? Really sorry for my terrible english ;) And here is my lighttpd.conf server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_rewrite", ) server.document-root = "/v...


php - lighttpd run python script as root

I'm trying execute a python script from php function shell_exec(), but this script require root privileges. The python code is very simple. Using libraries wifi python does a scan of all the SSID and provides in output the information on the various wireless networks to which he had a scan in JSON format. WiFi libraries are scanning using iwlist that requires root privileges. If it is performed by a user who does ...


python - FastCGI, Lighttpd, and Flask

I'm setting up a simple web server on my Raspberry Pi and I can't seem to set up lighttpd, fastcgi, and flask correctly. By now, I've gone through a few iterations of /etc/lighttpd/lighttpd.conf, the most recent one being fastcgi.server = ("/test" => "test" => ( "socket" => "/tmp/test-fcgi.sock", "bin-path" => "/var/www/py/test.fcgi", "check-local...






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top