Skip to content

Instantly share code, notes, and snippets.

@dcode
Last active February 15, 2018 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcode/cbd4279190fe286b8741777b9ae73af3 to your computer and use it in GitHub Desktop.
Save dcode/cbd4279190fe286b8741777b9ae73af3 to your computer and use it in GitHub Desktop.
Currently working lighttpd config

First, you need to enable the vhost config in lighttpd:

sudo sed -i '/^#.*vhosts\.d\/\*\.conf/ s/^#//' /etc/lighttpd/lighttpd.conf

Finally create the lighttpd docket vhost log dir

sudo mkdir -p /var/log/lighttpd/docket
sudo chown lighttpd:lighttpd /var/log/lighttpd/docket

NOTE If you want to use a network socket instead of the UNIX socket, you need to allow lighttpd to perform a network connect in the SELinux policy. You can do that like this:

sudo setsebool httpd_can_network_connect 1
[uwsgi]
plugins = python, systemd_logger
pythonpath = /opt/rocknsm/docket/docket
module = wsgi:application
master = true
processes = 5
die-on-term = true
# If you start with systemd and use a UNIX socket,
# uwsgi will automagically get that info from systemd.
# Otherwise you can use a network socket like so:
#socket = 127.0.0.1:8000
logger = systemd
# req-logger is supposed to let the native pythong logging framework function
# But, not yet. I get stack traces at least
req-logger = python
# file: /etc/lighttpd/conf.d/docket_scgi.conf
server.modules += ( "mod_scgi" )
scgi.protocol = "uwsgi"
scgi.server = (
"/" => ((
# Ensure lighttpd doesn't try to validate the URL
"check-local" => "disable",
# Needed to pass through leading "/" via uwsgi protocol
"fix-root-scriptname" => "enable",
# Use x-sendfile for faster file transfers from uwsgi
"x-sendfile" => "enable",
"x-sendfile-docroot" => ("/var/spool/docket"),
# Use the unix domain socket for local communication
"socket" => "/run/docket/docket.socket",
)),
)
#######################################################################
## Docket virtual host config
## file: /etc/lighttpd/vhosts.d/docket.conf
$SERVER["socket"] == "0.0.0.0:8080" {
var.server_name = "docket"
server.name = server_name
# IMPORTANT: Make sure you create this dir and chown it to the lighttpd user
accesslog.filename = log_root + "/" + server.name + "/access.log"
ssl.engine = "disable"
#ssl.pemfile = "/etc/pki/tls/private/lighttpd_docket.pem"
include "conf.d/docket_scgi.conf"
}
##
#######################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment