DEBIAN7 configuration lamp (apache/mysql/php) environment and construction station

Source: Internet
Author: User
Tags install wordpress

Complete DEBIAN7 configuration lamp (apache/mysql/php) environment and construction station

First, install and configure the Apache Web server

Run the upgrade command to ensure that all aspects of our system components are up-to-date.

Apt-get Update
Apt-get Upgrade--show-upgraded

To install the current version of the Apache Web server (in the 2.x series), execute the following command:

Apt-get Install Apache2

Most application sites use the path rewrite (pseudo-static) feature, the default Apache is not installed, we need to run script support rewrite

A2enmod rewrite

Start rewrite.

Edit/etc/apache2/apache2.conf file configuration to optimize system operation (test machine based on 1GB memory VPS)

<ifmodule mpm_prefork_module>
Startservers 2
Minspareservers 6
Maxspareservers 12
MaxClients 80
Maxrequestsperchild 3000
</IfModule>

This step we can also default, and so on the site to adjust the operation of the comparison is different, the old left currently do not understand the parameters of the corresponding performance differences, I used to MAPN environment when MySQL occupied too much, and then adjusted the occupancy rate is much lower.

After the configuration is complete, we need to configure the domain name, sub-domain name add site below.

Second, configure the virtual host, bind the domain name

In/etc/apache2/sites-available/ folder, used to store all site site domain name profile, set up the site with a domain name. conf Such sites can also see the corresponding site. For example, we want to create 2 sites here, we need to configure 2 conf files, as follows:

Site A-/etc/apache2/sites-available/laozuo.org.conf

<virtualhost *:80>
ServerAdmin [email protected]
ServerName laozuo.org
Serveralias www.laozuo.org
documentroot/srv/www/laozuo.org/public_html/
Errorlog/srv/www/laozuo.org/logs/error.log
Customlog/srv/www/laozuo.org/logs/access.log combined
</VirtualHost>

Site B-/etc/apache2/sites-available/idcxen.com.conf

<virtualhost *:80>
ServerAdmin [email protected]
Servernameidcxen.com
Serveralias www.idcxen.com
documentroot/srv/www/idcxen.com/public_html/
Errorlog/srv/www/idcxen.com/logs/error.log
Customlog/srv/www/idcxen.com/logs/access.log combined
</VirtualHost>

According to the above demonstration, we have several sites to build several. conf file, and then configure it for the path. We also need to create a few directories that are involved in the same.

Mkdir-p/srv/www/laozuo.org/public_html
Mkdir/srv/www/laozuo.org/logs

Mkdir-p/srv/www/idcxen.com/public_html
Mkdir/srv/www/idcxen.com/logs

Execute a command to start a site

A2ensite laozuo.org.conf
A2ensite idcxen.com.conf

Launch Apache

Service Apache2 Restart

Note: If we want to cancel this site to run, then use this command to cancel this site

A2dissite laozuo.org.conf

Third, install and configure the MySQL database

A-Install MySQL

Apt-get Install Mysql-server

We need to enter the root user password for MySQL during execution, which is a bit more complicated. The database configuration file is in/etc/mysql/my.cnf, if we need to adjust as much as possible first back up one.

B-Configure MySQL to build a database

Mysql_secure_installation

We need to enter the MySQL database root password set above in order to enter, the first entry will ask if we need to modify, and other various settings, we choose the n/y option as needed.

Mysql-u root-p

Create Database laozuoorg;
Grant all on laozuoorg.* to ' Laozuouser ' identified by ' laozuo.org ';

Use root privileges to enter the MySQL database, enter the password we previously set, and then build the laozuoorg database name,laozuouser data table, and laozuo.org Set the database password.

After creation, enter quit to quit MySQL setup.

IV. Installing and setting up the PHP environment

Apt-get Install PHP5 php-pear

After installation we need to configure the php.ini file (/etc/php5/apache2/php.ini) can be changed by default

Max_execution_time = 30
Memory_limit = 128M
error_reporting = e_compile_error| e_recoverable_error| e_error| E_core_error
Display_errors = Off
Log_errors = On
Error_log =/var/log/php.log
Register_globals = Off
Max_input_time = 30

We also need to create a log directory and set permissions

mkdir/var/log/php
Chown www-data/var/log/php

If we need PHP support for MySQL, then we have to install the PHP5 MySQL package under the command:

Apt-get Install Php5-mysql

Launch Apache

Service Apache2 Restart

In this way, through the above four steps, you can build a site, database, and then we just need to/srv/www/idcxen.com/public_html upload Web program, and then follow the instructions to install it.

PS: Old left install WordPress successful, the only need to note that root permissions need to be writable. htaccess or manually create a pseudo-static file, so that the background of the fixed connection after the setting takes effect.

Chown-r www-data:www-data/srv/www/

This article was transferred from: http://www.laozuo.org/3423.html | Old Left Blog

Debian7 Configure lamp (apache/mysql/php) environment and build station

Related Article

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.