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)  編輯  收藏 所屬分類: 嵌入式

          主站蜘蛛池模板: 新巴尔虎右旗| 大港区| 资源县| 资中县| 剑川县| 潮安县| 湄潭县| 图木舒克市| 黑山县| 南华县| 安塞县| 姚安县| 武冈市| 石门县| 建昌县| 梨树县| 沙河市| 平乡县| 旬邑县| 雅安市| 呼和浩特市| 淮阳县| 梅河口市| 突泉县| 嘉义市| 湘乡市| 和林格尔县| 宁河县| 衡阳县| 黔南| 青岛市| 布拖县| 伊宁县| 图们市| 保靖县| 拉孜县| 安多县| 江北区| 渑池县| 惠来县| 武夷山市|