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

Configuring a web server

There are several web servers available that we can install on your Raspberry Pi. We're going to install the lighttpd web server. Also, we need to install PHP support, which will help us run a website into our Raspberry Pi and have dynamic web pages.

To install and configure, log in to the Raspberry Pi via the terminal console of PuTTY:

  1. Update the package installer:
     sudo apt-get update
    
  2. Install the lighttpd web server:
     sudo apt-get install lighttpd
    

Once installed, it will automatically start up as a background service; it will do so each time the Raspberry Pi starts up:

  1. To set up our PHP 5 interface for programming with PHP 5, we need to install the PHP5 module support with the following command; this is necessary to have our server, and it can execute PHP files so that we can make our website:
     sudo apt-get install php5-cgi
    
  2. Now we need to enable the PHP FastCGI module on our web server:
     sudo lighty-enable-mod fastcgi-php
    
  3. For the last step, we have to restart the server with the following command:
     sudo /etc/init.d/lighttpd
    

In the following screenshot, we show the content of the page that will to appear when we configure the web server and the PHP 5 interface. The web server installs a test placeholder page in the location /var/www. Type the IP address of your Raspberry Pi in the browser, for example, http://192.168.1.105/, and the following screen appears, opening the active page of the configured server:

Configuring a web server
主站蜘蛛池模板: 海城市| 灌云县| 许昌县| 科技| 文成县| 沭阳县| 海伦市| 神池县| 迁安市| 姚安县| 广东省| 丰都县| 丹寨县| 旺苍县| 安乡县| 济源市| 嵊泗县| 石景山区| 额尔古纳市| 含山县| 安宁市| 公主岭市| 乌鲁木齐县| 钦州市| 蒙阴县| 耿马| 南召县| 乌鲁木齐市| 栖霞市| 西昌市| 同德县| 苏州市| 四会市| 那坡县| 广南县| 双柏县| 维西| 尤溪县| 谷城县| 丹巴县| 岐山县|