官术网_书友最值得收藏!

  • Lighttpd
  • Andre Bogus
  • 289字
  • 2021-08-25 18:06:20

Chapter 2. Configuring and Running Lighttpd

In this chapter, we will learn:

  • How to configure Lighttpd
  • What Selectors are
  • How to use Selectors
  • How to rewrite and redirect requests
  • How to include variables in the configuration files

Now that you have successfully installed Lighttpd onto your system, I will show you how to configure it to serve web pages (yes, just web pages, nothing else) and expand from there. Lighttpd needs a configuration file called lighttpd.conf—in fact it will not run without one. To make it as simple as possible, we start with the absolute minimum:

server.document-root = "/var/www"
mimetype.assign = ("" => "text/html")

Yes, that is all. Of course you should take the path to your website as your document root. Under UNIX, /var/www is a probable path, while Windows users may want to put their site in a place like C:\www\mysite. The mimetype.assign statement simply says that everything is to be served as if it were an HTML page.

Put this lighttpd.conf into the standard directory of your system:

In Windows, all the installers that I tested put the lighttpd.conf file and run scripts under C:\lighttpd by default. However, we might want to change the Lighttpd directory to suit our system, for example, we may want to put it under "Program Files" or on another disk drive. We may alternatively put the lighttpd.conf file into any directory of our choice, but then the run scripts provided with Lighttpd may not work. This is not a big deal though, as we can still start Lighttpd directly from the command line. Note that under most systems, Lighttpd needs to be started from the administrator or root account so that it can listen to port 80.

主站蜘蛛池模板: 弥勒县| 申扎县| 娄底市| 康平县| 方山县| 日土县| 永春县| 昌平区| 桂平市| 鄂尔多斯市| 杭锦后旗| 隆子县| 临沂市| 华蓥市| 江阴市| 左贡县| 盘锦市| 庆城县| 阿拉善左旗| 云安县| 叶城县| 黔南| 镇江市| 睢宁县| 阿巴嘎旗| 独山县| 积石山| 育儿| 南宫市| 台湾省| 秦皇岛市| 辽阳县| 互助| 永靖县| 慈溪市| 海淀区| 延吉市| 会昌县| 永新县| 乌审旗| 文成县|