hello world

          隨筆 - 2, 文章 - 63, 評論 - 0, 引用 - 0
          數據加載中……

          ubuntu下lighttpd和php環境的搭建

          1、安裝lighttpd
          進入系統,直接安裝:
          sudo apt-get install lighttpd

          安裝完,查看lighttpd目錄:
          a***@a***:/usr/bin$ whereis lighttpd
          lighttpd: /usr/sbin/lighttpd /etc/lighttpd /usr/lib/lighttpd /usr/share/lighttpd /usr/share/man/man8/lighttpd.8.gz

          確認lighttpd狀態:
          a****@a***:/usr/bin$ sudo /etc/init.d/lighttpd status
          * lighttpd is running


          2、安裝php
          sudo apt-get install php5-cgi

          安裝完,查看php目錄:
          a***@a***:/usr/bin$ whereis php5
          php5: /etc/php5 /usr/lib/php5 /usr/share/php5
          a***@a***:/usr/bin$ whereis php5-cgi
          php5-cgi: /usr/bin/php5-cgi /usr/share/man/man1/php5-cgi.1.gz


          安裝完,查看php版本:
          a***@a***:/usr/bin$ /usr/bin/php5-cgi -v
          PHP 5.3.2-1ubuntu4.28 with Suhosin-Patch (cgi-fcgi) (built: Oct 29 2014 11:54:36)
          Copyright (c) 1997-2009 The PHP Group
          Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

          3、配置lighttpd支持php:
          /etc/lighttpd/lighttpd.conf是lighttpd的主要配置文件,需要將文件做如下兩步修改:
           1)、 增加"mod_fastcgi", "mod_cgi"兩項

          修改前:
          server.modules = (
                      "mod_access", 
          "mod_alias",
          "mod_accesslog",
          "mod_compress",
          )


          修改后:
          server.modules = (
          "mod_access",
          "mod_fastcgi",
          "mod_cgi",
          "mod_alias",
          "mod_accesslog",

                      "mod_compress",

          )


           2)在文件尾增加:
          fastcgi.server = ( ".php" =>
          ( "localhost" =>
          (
          "socket" => "/tmp/php.socket",
          "bin-path" => "/usr/bin/php5-cgi"
          )
          )
          )


          4、重啟lighttpd服務器:
          a***@a***:/usr/bin$ sudo /etc/init.d/lighttpd restart
          [sudo] password for a***:
          Syntax OK
          * Stopping web server lighttpd [ OK ]
          Syntax OK
          * Starting web server lighttpd [ OK ]

          這下在var/www/下新增一個php文件就可以讀出來了。

          參考文檔:
          http://blog.chinaunix.net/uid-20761674-id-276003.html
          http://blog.csdn.net/l0605020112/article/details/10104233
          http://www.linuxidc.com/Linux/2011-12/48808.htm
          http://zhidao.baidu.com/link?url=Wy8_Mx_bduKs3F7_kBKYiQ7m0s_-zCPSQFvglZL3xJMsva9oVX8XKm7yWjoHGyLVl2lrMgKhpX-ukmiKG4hT5K

          posted on 2015-03-12 12:22 聽風 閱讀(404) 評論(0)  編輯  收藏 所屬分類: 嵌入式

          主站蜘蛛池模板: 岗巴县| 甘肃省| 霍林郭勒市| 车险| 嵩明县| 金阳县| 山阴县| 五指山市| 南宫市| 本溪市| 瓦房店市| 汝阳县| 即墨市| 新宁县| 信丰县| 赣州市| 卢龙县| 铜山县| 左云县| 兴文县| 漳平市| 正镶白旗| 碌曲县| 冕宁县| 新沂市| 陵水| 利津县| 油尖旺区| 古丈县| 晋中市| 万州区| 沁源县| 河南省| 喜德县| 西青区| 五寨县| 凤阳县| 南漳县| 中方县| 喜德县| 会同县|