Debian builds Lighttpd + MySQL + Zend + vsftpd + PHP Web Environment

Source: Internet
Author: User
Tags debian server vps vps server

The first step is to switch your VPS system to the Debian system (Debian 4.0 is said to be one of the most stable systems with the least bugs at present, although not powerful as CentOS, It is enough ):

1.0 open the HyperVM Control Panel to manage VPS. After successful login;

1.1.0 select Rebuild

1.1.1 select VPS as Debian and check "Confirm Rebuild". Then click "Update" to reinstall the system.

[Prompt] You can reinstall it every 10 minutes.

1.2.0 OK. Let's log on to the VPS server. Use PuTTY to log on to our VPS.

Open PuTTY, enter the Server IP address and port, select the ssh connection method, and click "open" to log on to the server.

When the switch key is displayed for the first connection, click Yes (OK ).

Next, enter the user name and password on the login page (Tip: copy the password first. Right-click the password and save the trouble of manual input)

For a Linux Common Information view command reference (it does not matter if you do not view it .)

Http://blog.licess.cn/linux-info-command/

Exit command

Enter exit and press enter to disconnect.

After logging in, let me start installing the WEB environment.

2.0 update the Debian server before installation.

Use commands

Apt-get update

2.1.0 start installing MYSQL5.0

Enter the command

Apt-get install mysql-server mysql-client

"Do you want to continue [Y/n]?" appears in the middle.

Enter y and press enter to continue installation

2.1.1 check whether MYSQL works.

Enter the command

Netstat-tap | grep mysql

2.1.2 set the MySql administrator password

Command

Mysqladmin-u root password your password
Set the root password to anqun.
Mysqladmin-u root password 1234

2.1.3 use the ROOT account to log on to MYSQL.

Command

Mysql-u root-p

Enter the password. Press enter to log on to MYSQL.

After MySQL is successfully installed, we start to install the WWW server Lighttpd.

2.2.0 install Lighttpd

Installation command

Apt-get install lighttpd

Open your independent IP address and you will see the welcome page. The installation is successful!

Lighttpd default webpage folder

/Var/www

Lighttpd configuration file

/Etc/lighttpd. conf

OK, Lighttpd. After the installation is successful, we will install PHP to allow Lighttpd to support PHP!

2.2.1 install PHP.

Command

Apt-get install php5-cgi

2.2.2 enable Lighttpd to support PHP

We want to modify two files.

    1. /Etc/php5/cgi/php. ini
    2. /Etc/lighttpd. conf

The modification method usually uses VI commands... but I won't use them... fortunately, the HyperVM Control Panel provided us with enough online system file management.

Return to the HyperVM control panel and click "File Manager" to go to online File management.

First, find/etc/php5/cgi/php. ini.

Turn it on to the edit status.

Insert in the last row

Cgi. fix_pathinfo = 1

Note: after this code, make sure to leave another line blank!

Then save

Edit/etc/lighttpd. conf in the same way.

[...]
Server. modules = (
"Mod_access ",
"Mod_alias ",
"Mod_accesslog ",
"Mod_fastcgi ",
# "Mod_rewrite ",
# "Mod_redirect ",
# "Mod_status ",
# "Mod_evhost ",
# "Mod_compress ",
# "Mod_usertrack ",
# "Mod_rrdtool ",
# "Mod_webdav ",
# "Mod_expire ",
# "Mod_flv_streaming ",
# "Mod_evasive"
)
[...]

Add code:

"Mod_fastcgi ",

Note the comma.

Add at the end of the file

Fastcgi. server = (". php" => ((
"Bin-path" => "/usr/bin/php5-cgi ",
"Socket" => "/tmp/php. socket"
)))

Save to complete the association between Lighttpd and PHP.

Restart lighttpd

/Etc/init. d/lighttpd restart

2.2.3 test PHP.

We use iProber probes to test the environment.

Similarly, use the HyperVM control panel "File Manager to upload iProber. php to/var/www.

IProber probe download http://soft.vpser.net/prober/iProber.zip

Then we open http: // your independent IP/iProber. php

This page indicates that PHP runs successfully ..........

2.3 let PHP support MYSQL.

So excited! PHP is installed ....

But suddenly found above the probe

MYSQL is not supported !!!!

Ah! I still haven't done it yet! Okay ~ Let's get along with our php and mysql!

For MySQL support in PHP, we can install the php5-MySQL solution. This is a good idea to install some other php5 modules as well as allow them for your application. You can search for available php5 modules and use this command:

Apt-cache search php5

At this point we saw the php5-mysql module, but to ensure the server to support most programs, we also need to install other required modules, such as php5-curl php5-gd php-pear and so on. Run the following command:

Apt-get install php-pear php5-curl php5-dev php5-gd php5-idn php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-snmp

Note: The php5-suhosin module is the security protection system mentioned above, it has two installation methods, here is to use the module installation method is equivalent to the PHP5 patch. I will refer to third-party extensions for installation later.

Restart our Lighttpd

/Etc/init. d/lighttpd restart

Now open the probe address. Is the connection successful?

3.0 install Zend

To install Zend, We need to log on to the official Zend website to download it. To download it, we need a user name. We can register one. Of course this is free, and then download the corresponding version, then upload the file to the Root user directory/root

The installation process is as follows:

Wgethttp: // downloads.zend.com/optimizer/3.3.3/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
Tar-zxf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
Cd ZendOptimizer-3.3.3-linux-glibc23-i386
Sh install. sh

During installation, we will show you relevant instructions and allow you to agree to the terms. We don't care about them. We need to note that it will allow you to enter the current php. enter/etc/php5/cgi in the directory where ini is located. Then, you will be asked if you want to use Apache Web Server. Because we have selected Lighttpd, here we select no and the installation is complete, the system will tell you the previous php. ini has been backed up to php. ini. bak, new php. the directory where the INI file is located is/usr/local/Zend/etc/. If you want to modify php settings later, you need to go to the/usr/local/Zend/etc/directory to modify php. ini.

Then enter:

Cd ..
Rm-rf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz ZendOptimizer-3.3.3-linux-glibc23-i386

Delete the previous Installation File

4.0 install suhosin

We have mentioned that suhosin has two methods. The above method is to install suhosin in a patch package. Here we will install suhosin in the form of third-party extensions. The installation process is as follows:

Wgethttp: // download.suhosin.org/suhosin-0.9.27.tgz
Tar-zxf suhosin-0.9.27.tgz
Cd suhosin-0.9.27
Phpize
./Configure
Make & make install
Cd ..
Rm-rf suhosin-0.9.27.tgz suhosin-0.9.27

Then add the following content to the/usr/local/Zend/etc/php. ini file:

[Suhosin]
Extension = suhosin. so

Suhosin's default configuration is enough to meet the needs of most people. If you need to enhance the settings, you can add the corresponding values in the php. ini file. Please log on to http://www.hardened-php.net/suhosin/#using_suhosin for details

5.0 install Ftp server software

As a server, FTP server software must be installed. There are many excellent Ftpd software in Linux. Here we use vsftpd, which is short and accurate enough to meet our needs. Run the following command:

Apt-get install vsftpd

After the installation is complete, the default configuration file is/etc/vsftpd. conf.

Start vsftpd:

/Etc/init. d/vsftpd start

Run the following command to create an FTP account and the corresponding directory:

Useradd FTP account-d/home/the directory name you want-s/bin/nologin

For example, to create a 123 user in the 456 directory, the command should be:

Useradd 456-d/home/123-s/bin/nologin

-S/bin/nologin indicates that SSH Login is prohibited. If this parameter is removed, SSH can be used.

Use passwd user name to set the User Password

Passwd User Name

A password prompt is displayed. Enter the password.

6.0 install phpmyadmin

Apt-get install phpmyadmin

After installation, if it appears in the/usr/share/directory, enter the following

Mv/usr/share/phpmyadmin/var/www/phpmyadmin

Move Directories

After the installation is successful, you can directly log on

Http: // your independent IP/phpmyadmin

> Reprinted please indicate the source: VPS detective link address: http://www.vpser.net/build/debian-vps-web-server.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.