Skip to content

Instantly share code, notes, and snippets.

@joepie91
Created July 30, 2014 18:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joepie91/e5bd63710b5910d2287a to your computer and use it in GitHub Desktop.
Save joepie91/e5bd63710b5910d2287a to your computer and use it in GitHub Desktop.
PDFy lighttpd configuration
# /usr/share/doc/lighttpd/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi
server.modules += ( "mod_fastcgi" )
# -*- depends: fastcgi -*-
# /usr/share/doc/lighttpd/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi
## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server += ( ".php" =>
((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket"
))
)
server.modules = (
"mod_access",
"mod_accesslog",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_setenv",
# "mod_rewrite",
)
server.document-root = "/var/www"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
server.max-fds = 2048
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
$HTTP["host"] == "pdf.yt" {
var.server_name = "pdf.cryto.net"
server.name = server_name
##
## use trigger before download
##
server.document-root = "/var/sites/pdfhost/public_html"
##
## use a seperate access log file
## At the moment you cant have different error log files.
##
accesslog.filename = "/var/log/lighttpd/" + server_name + "/access.log"
server.error-handler-404 = "/rewrite.php"
}
$HTTP["host"] =~ "pdfy\.cryto\.net" {
url.redirect = (
"/(.*)" => "http://pdf.yt/$1"
)
url.redirect-code = 301
}
$HTTP["host"] =~ "pdf\.cryto\.net" {
url.redirect = (
"/(.*)" => "http://pdf.yt/$1"
)
url.redirect-code = 301
}
$HTTP["host"] =~ "www\.pdf\.yt" {
url.redirect = (
"/(.*)" => "http://pdf.yt/$1"
)
url.redirect-code = 301
}
$SERVER["socket"] == ":443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/lighttpd/ssl/pdf.yt.pem"
ssl.ca-file = "/etc/lighttpd/ca-certs.crt"
ssl.cipher-list = "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK"
ssl.use-sslv3 = "disable"
ssl.disable-client-renegotiation = "enable"
}
$HTTP["scheme"] == "https" {
setenv.add-response-header = ( "Strict-Transport-Security" => "max-age=63072000")
}
$HTTP["scheme"] == "http" {
$HTTP["host"] == "pdf.yt" {
url.redirect = (".*" => "https://pdf.yt$0")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment