Advertisement
Guest User

Untitled

a guest
Aug 31st, 2012
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.64 KB | None | 0 0
  1. #######################################################################
  2. ##
  3. ## /etc/lighttpd/lighttpd.conf
  4. ##
  5. ## check /etc/lighttpd/conf.d/*.conf for the configuration of modules.
  6. ##
  7. #######################################################################
  8.  
  9. #######################################################################
  10. ##
  11. ## Some Variable definition which will make chrooting easier.
  12. ##
  13. ## if you add a variable here. Add the corresponding variable in the
  14. ## chroot example aswell.
  15. ##
  16. var.log_root = "/var/log/lighttpd"
  17. var.server_root = "/srv/www"
  18. var.state_dir = "/var/run"
  19. var.home_dir = "/var/lib/lighttpd"
  20. var.conf_dir = "/etc/lighttpd"
  21.  
  22. ##
  23. ## run the server chrooted.
  24. ##
  25. ## This requires root permissions during startup.
  26. ##
  27. ## If you run Chrooted set the the variables to directories relative to
  28. ## the chroot dir.
  29. ##
  30. ## example chroot configuration:
  31. ##
  32. #var.log_root = "/logs"
  33. #var.server_root = "/"
  34. #var.state_dir = "/run"
  35. #var.home_dir = "/lib/lighttpd"
  36. #var.vhosts_dir = "/vhosts"
  37. #var.conf_dir = "/etc"
  38. #
  39. #server.chroot = "/srv/www"
  40.  
  41. ##
  42. ## Some additional variables to make the configuration easier
  43. ##
  44.  
  45. ##
  46. ## Base directory for all virtual hosts
  47. ##
  48. ## used in:
  49. ## conf.d/evhost.conf
  50. ## conf.d/simple_vhost.conf
  51. ## vhosts.d/vhosts.template
  52. ##
  53. var.vhosts_dir = server_root + "/vhosts"
  54.  
  55. ##
  56. ## Cache for mod_compress
  57. ##
  58. ## used in:
  59. ## conf.d/compress.conf
  60. ##
  61. var.cache_dir = "/var/cache/lighttpd"
  62.  
  63. ##
  64. ## Base directory for sockets.
  65. ##
  66. ## used in:
  67. ## conf.d/fastcgi.conf
  68. ## conf.d/scgi.conf
  69. ##
  70. var.socket_dir = home_dir + "/sockets"
  71.  
  72. ##
  73. #######################################################################
  74.  
  75. #######################################################################
  76. ##
  77. ## Load the modules.
  78. include "modules.conf"
  79.  
  80. ##
  81. #######################################################################
  82.  
  83. #######################################################################
  84. ##
  85. ## Basic Configuration
  86. ## ---------------------
  87. ##
  88. server.port = 80
  89.  
  90. ##
  91. ## Use IPv6?
  92. ##
  93. server.use-ipv6 = "disable"
  94.  
  95. ##
  96. ## bind to a specific IP
  97. ##
  98. #server.bind = "localhost"
  99.  
  100. ##
  101. ## Run as a different username/groupname.
  102. ## This requires root permissions during startup.
  103. ##
  104. server.username = "lighttpd"
  105. server.groupname = "lighttpd"
  106.  
  107. ##
  108. ## enable core files.
  109. ##
  110. #server.core-files = "disable"
  111.  
  112. ##
  113. ## Document root
  114. ##
  115. server.document-root = server_root + "/lighttpd"
  116.  
  117. ##
  118. ## The value for the "Server:" response field.
  119. ##
  120. ## It would be nice to keep it at "lighttpd".
  121. ##
  122.  
  123. ##
  124. ## store a pid file
  125. ##
  126. server.pid-file = state_dir + "/lighttpd.pid"
  127.  
  128. ##
  129. #######################################################################
  130.  
  131. #######################################################################
  132. ##
  133. ## Logging Options
  134. ## ------------------
  135. ##
  136. ## all logging options can be overwritten per vhost.
  137. ##
  138. ## Path to the error log file
  139. ##
  140. server.errorlog = log_root + "/error.log"
  141.  
  142. ##
  143. ## If you want to log to syslog you have to unset the
  144. ## server.errorlog setting and uncomment the next line.
  145. ##
  146. #server.errorlog-use-syslog = "enable"
  147.  
  148. ##
  149. ## Access log config
  150. ##
  151. include "conf.d/access_log.conf"
  152.  
  153. ##
  154. ## The debug options are moved into their own file.
  155. ## see conf.d/debug.conf for various options for request debugging.
  156. ##
  157. include "conf.d/debug.conf"
  158.  
  159. ##
  160. #######################################################################
  161.  
  162. #######################################################################
  163. ##
  164. ## Tuning/Performance
  165. ## --------------------
  166. ##
  167. ## corresponding documentation:
  168. ## http://www.lighttpd.net/documentation/performance.html
  169. ##
  170. ## set the event-handler (read the performance section in the manual)
  171. ##
  172. ## possible options on linux are:
  173. ##
  174. ## select
  175. ## poll
  176. ## linux-sysepoll
  177. ##
  178. ## linux-sysepoll is recommended on kernel 2.6.
  179. ##
  180. server.event-handler = "linux-sysepoll"
  181.  
  182. ##
  183. ## The basic network interface for all platforms at the syscalls read()
  184. ## and write(). Every modern OS provides its own syscall to help network
  185. ## servers transfer files as fast as possible
  186. ##
  187. ## linux-sendfile - is recommended for small files.
  188. ## writev - is recommended for sending many large files
  189. ##
  190. server.network-backend = "linux-sendfile"
  191.  
  192. ##
  193. ## As lighttpd is a single-threaded server, its main resource limit is
  194. ## the number of file descriptors, which is set to 1024 by default (on
  195. ## most systems).
  196. ##
  197. ## If you are running a high-traffic site you might want to increase this
  198. ## limit by setting server.max-fds.
  199. ##
  200. ## Changing this setting requires root permissions on startup. see
  201. ## server.username/server.groupname.
  202. ##
  203. ## By default lighttpd would not change the operation system default.
  204. ## But setting it to 2048 is a better default for busy servers.
  205. ##
  206. server.max-fds = 2048
  207.  
  208. ##
  209. ## Stat() call caching.
  210. ##
  211. ## lighttpd can utilize FAM/Gamin to cache stat call.
  212. ##
  213. ## possible values are:
  214. ## disable, simple or fam.
  215. ##
  216. server.stat-cache-engine = "simple"
  217.  
  218. ##
  219. ## Fine tuning for the request handling
  220. ##
  221. ## max-connections == max-fds/2 (maybe /3)
  222. ## means the other file handles are used for fastcgi/files
  223. ##
  224. server.max-connections = 1024
  225.  
  226. ##
  227. ## How many seconds to keep a keep-alive connection open,
  228. ## until we consider it idle.
  229. ##
  230. ## Default: 5
  231. ##
  232. #server.max-keep-alive-idle = 5
  233.  
  234. ##
  235. ## How many keep-alive requests until closing the connection.
  236. ##
  237. ## Default: 16
  238. ##
  239. #server.max-keep-alive-requests = 16
  240.  
  241. ##
  242. ## Maximum size of a request in kilobytes.
  243. ## By default it is unlimited (0).
  244. ##
  245. ## Uploads to your server cant be larger than this value.
  246. ##
  247. #server.max-request-size = 0
  248.  
  249. ##
  250. ## Time to read from a socket before we consider it idle.
  251. ##
  252. ## Default: 60
  253. ##
  254. #server.max-read-idle = 60
  255.  
  256. ##
  257. ## Time to write to a socket before we consider it idle.
  258. ##
  259. ## Default: 360
  260. ##
  261. #server.max-write-idle = 360
  262.  
  263. ##
  264. ## Traffic Shaping
  265. ## -----------------
  266. ##
  267. ## see /usr/share/doc/lighttpd/traffic-shaping.txt
  268. ##
  269. ## Values are in kilobyte per second.
  270. ##
  271. ## Keep in mind that a limit below 32kB/s might actually limit the
  272. ## traffic to 32kB/s. This is caused by the size of the TCP send
  273. ## buffer.
  274. ##
  275. ## per server:
  276. ##
  277. #server.kbytes-per-second = 128
  278.  
  279. ##
  280. ## per connection:
  281. ##
  282. #connection.kbytes-per-second = 32
  283.  
  284. ##
  285. #######################################################################
  286.  
  287. #######################################################################
  288. ##
  289. ## Filename/File handling
  290. ## ------------------------
  291.  
  292. ##
  293. ## files to check for if .../ is requested
  294. ## index-file.names = ( "index.php", "index.rb", "index.html",
  295. ## "index.htm", "default.htm" )
  296. ##
  297. index-file.names += (
  298. "index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
  299. )
  300.  
  301. ##
  302. ## deny access the file-extensions
  303. ##
  304. ## ~ is for backupfiles from vi, emacs, joe, ...
  305. ## .inc is often used for code includes which should in general not be part
  306. ## of the document-root
  307. url.access-deny = ( "~", ".inc" )
  308.  
  309. ##
  310. ## disable range requests for pdf files
  311. ## workaround for a bug in the Acrobat Reader plugin.
  312. ##
  313. $HTTP["url"] =~ "\.pdf$" {
  314. server.range-requests = "disable"
  315. }
  316. # wp permlink, running on web server root, works fine
  317. $HTTP["host"] =~ "mywebsite.com" {
  318. url.rewrite-final = (
  319.  
  320. # Exclude some directories from rewriting
  321. "^/wp/(wp-admin|wp-includes|wp-content|gallery2)/(.*)" => "$0",
  322.  
  323. # Exclude .php files at root from rewriting
  324. "^/wp/(.*.php)" => "$0",
  325.  
  326. # Handle permalinks and feeds
  327. "^/wp/(.*)$" => "/main/index.php/$1"
  328. )
  329. }
  330.  
  331. $HTTP["host"] =~ "(^|\.)test1\.com$" {
  332. server.document-root = "/home/test1"
  333. }
  334.  
  335. $HTTP["host"] =~ "(^|\.)test2\.com$" {
  336. server.document-root = "/home/test2"
  337. }
  338.  
  339. ##
  340. ## url handling modules (rewrite, redirect)
  341. ##
  342. #url.rewrite = ( "^/$" => "/server-status" )
  343. #url.redirect = ( "^/wishlist/(.+)" => "http://www.example.com/$1" )
  344.  
  345. ##
  346. ## both rewrite/redirect support back reference to regex conditional using %n
  347. ##
  348. #$HTTP["host"] =~ "^www\.(.*)" {
  349. # url.redirect = ( "^/(.*)" => "http://%1/$1" )
  350. #}
  351. ##
  352. ## which extensions should not be handle via static-file transfer
  353. ##
  354. ## .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
  355. ##
  356. static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
  357.  
  358. ##
  359. ## error-handler for status 404
  360. ##
  361. server.error-handler-404 = "/error.html"
  362. #server.error-handler-404 = "/error-handler.php"
  363.  
  364. ##
  365. ## Format: <errorfile-prefix><status-code>.html
  366. ## -> ..../status-404.html for 'File not found'
  367. ##
  368. #server.errorfile-prefix = "/srv/www/htdocs/errors/status-"
  369.  
  370. ##
  371. ## mimetype mapping
  372. ##
  373. include "conf.d/mime.conf"
  374.  
  375. ##
  376. ## directory listing configuration
  377. ##
  378. include "conf.d/dirlisting.conf"
  379.  
  380. ##
  381. ## Should lighttpd follow symlinks?
  382. ##
  383. server.follow-symlink = "enable"
  384.  
  385. ##
  386. ## force all filenames to be lowercase?
  387. ##
  388. #server.force-lowercase-filenames = "disable"
  389.  
  390. ##
  391. ## defaults to /var/tmp as we assume it is a local harddisk
  392. ##
  393. server.upload-dirs = ( "/var/tmp" )
  394.  
  395. ##
  396. #######################################################################
  397.  
  398.  
  399. #######################################################################
  400. ##
  401. ## SSL Support
  402. ## -------------
  403. ##
  404. ## To enable SSL for the whole server you have to provide a valid
  405. ## certificate and have to enable the SSL engine.::
  406. ##
  407. ## ssl.engine = "enable"
  408. ## ssl.pemfile = "/path/to/server.pem"
  409. ##
  410. ## The HTTPS protocol does not allow you to use name-based virtual
  411. ## hosting with SSL. If you want to run multiple SSL servers with
  412. ## one lighttpd instance you must use IP-based virtual hosting: ::
  413. ##
  414. ## $SERVER["socket"] == "10.0.0.1:443" {
  415. ## ssl.engine = "enable"
  416. ## ssl.pemfile = "/etc/ssl/private/www.example.com.pem"
  417. ## server.name = "www.example.com"
  418. ##
  419. ## server.document-root = "/srv/www/vhosts/example.com/www/"
  420. ## }
  421. ##
  422.  
  423. ## If you have a .crt and a .key file, cat them together into a
  424. ## single PEM file:
  425. ## $ cat /etc/ssl/private/lighttpd.key /etc/ssl/certs/lighttpd.crt \
  426. ## > /etc/ssl/private/lighttpd.pem
  427. ##
  428. #ssl.pemfile = "/etc/ssl/private/lighttpd.pem"
  429.  
  430. ##
  431. ## optionally pass the CA certificate here.
  432. ##
  433. ##
  434. #ssl.ca-file = ""
  435.  
  436. ##
  437. #######################################################################
  438.  
  439. #######################################################################
  440. ##
  441. ## custom includes like vhosts.
  442. ##
  443. #include "conf.d/config.conf"
  444. include_shell "cat /etc/lighttpd/vhosts.d/*.conf"
  445. ##
  446. #######################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement