Cubieboard Linux服务器教程三
本系列教程主要讲解通过Cubieboard 板子做一个小型的 Linux 服务器,用户可以通过浏览器访问到Cubieboard 服务器。教程三主要讲解Cubieboard Linux服务器配置HTTP服务,使用Nginx作为Web服务容器。搭建一个Linux + Nginx + MySQL + PHP的LNMP环境。 Linaro D
本系列教程主要讲解通过Cubieboard 板子做一个小型的 Linux 服务器,用户可以通过浏览器访问到Cubieboard 服务器。教程三主要讲解Cubieboard Linux服务器配置HTTP服务,使用Nginx作为Web服务容器。搭建一个Linux + Nginx + MySQL + PHP的LNMP环境。
Linaro Debian Linux 安装 Nginx + MySQL + PHP
通过以下命令一键安装:
apt-get update
apt-get upgrade
apt-get install nginx php5-cli php5-cgi spawn-fcgi mysql-server mysql-client php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
OK,完成以上命令的安装后,默认的安装版本是:
- Nginx 1.2.1
- MySQL 5.5.27-0ubuntu2
- PHP Version 5.4.6-1ubuntu1
配置虚拟主机
在本文中“cb.lixiphp.com”作为一个网站例子。您应该在后续步骤的配置中取代为你自己的域名。首先,创建目录来保存内容和日志文件:
mkdir -p /srv/www/cb.lixiphp.com/public_html
mkdir /srv/www/cb.lixiphp.com/logs
chown -R www-data:www-data /srv/www/cb.lixiphp.com
public_html 目录用于存储Web程序,外网可以访问。
logs 目录用于存储Nginx的日志文件,包括访问日志和错误日志。
Nginx 配置示例:
修改nginx的虚拟主机配置文件类似于下面的示例:
文件位置: /etc/nginx/sites-available/cb.lixiphp.com
server {
server_name cb.lixiphp.com example.com;
access_log /srv/www/cb.lixiphp.com/logs/access.log;
error_log /srv/www/cb.lixiphp.com/logs/error.log;
root /srv/www/cb.lixiphp.com/public_html;
location / {
index index.php index.html index.htm;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/cb.lixiphp.com/public_html$fastcgi_script_name;
}
}
root 目录为当前cb.lixiphp.com指向的Web根目录。
index 为默认的索引文件。
创建一个文件 /usr/bin/php-fastcgi 使用以下的内容:
文件位置: /usr/bin/php-fastcgi
#!/bin/bash
FASTCGI_USER=www-data
FASTCGI_GROUP=www-data
ADDRESS=127.0.0.1
PORT=9000
PIDFILE=/var/run/php-fastcgi/php-fastcgi.pid
CHILDREN=6
PHP5=/usr/bin/php5-cgi
/usr/bin/spawn-fcgi -a $ADDRESS -p $PORT -P $PIDFILE -C $CHILDREN -u $FASTCGI_USER -g $FASTCGI_GROUP -f $PHP5
使用以下命令使其可执行:
chmod +x /usr/bin/php-fastcgiCopy after login
启用和启动服务:
使用以下命令来启用该网站:
cd /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/cb.lixiphp.com
创建一个文件 /etc/init.d/php-fastcgi 使用以下的内容:
(...)
Read the rest of Cubieboard Linux服务器教程三 (235 words)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

VS Code One-step/Next step shortcut key usage: One-step (backward): Windows/Linux: Ctrl ←; macOS: Cmd ←Next step (forward): Windows/Linux: Ctrl →; macOS: Cmd →

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)
