In this article, I will share my other favorite DEBIAN system environment. It may be preferred by novices One click installation package , but this step installation is more clear about what you need to install, and it can save resources. Some components do not need to be installed, so it is unnecessary to install them. Later, if you have the opportunity, Lao Zuo will also make these steps into a one click package, which will be a little more convenient.
Installation environment: This article demonstrates Debian 7 32-bit.
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
Install the current version of Apache Web server (in the 2.x Series), and execute the following command:
apt-get install apache2
Most application websites use path rewrite (pseudo static) function. APACHE is not installed by default. We need to run scripts to support rewrite
a2enmod rewrite
Start rewrite.
Edit the / etc/apache2/apache2.conf file configuration to make the system run more optimized (the test machine is based on 1GB memory VPS)
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 80
MaxRequestsPerChild 3000
</IfModule>
In this step, we can also acquiesce, and so on, and so on, so that the adjustment of the website's operation can be compared. What's the difference between Lao and left? I don't understand the performance difference between the parameters. Before I used MAPN, MYSQL occupied too much, and then adjusted the occupancy rate was much lower.
After configuration, we need to configure the domain name and subdomain to add sites.
Second, configure virtual host and bind domain name
In the / etc / apache2 / sites available / folder, it is used to store the site domain name configuration files of all sites. When setting a site, you can also see the corresponding site when there are many sites named. Conf. For example, to create two sites, we need to configure two conf files, as follows:
Site a - / etc / apache2 / sites available / laozuo.org.conf
<VirtualHost *:80>
ServerAdmin admin@laozuo.org
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 webmaster@idcxen.com
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 files, and then configure their paths. We also need to create several directories mentioned above.
mkdir -p /srv/www/laozuo.org/public_html
mkdir /srv/www/laozuo.org/logsmkdir -p /srv/www/idcxen.com/public_html
mkdir /srv/www/idcxen.com/logs
Execute command to start site
a2ensite laozuo.org.conf
a2ensite idcxen.com.conf
Start Apache
service apache2 restart
Note: if we want to cancel this site, use this command to cancel this site
a2dissite laozuo.org.conf
Third, install and configure MySQL database
A - install MYSQL
apt-get install mysql-server
During execution, we need to enter the ROOT user password of MYSQL, which is a little more complicated. The database configuration file is in / etc/mysql/my.cnf. If we need to adjust, try to back up one first.
B - configure MySQL to establish database
mysql_secure_installation
You need to enter the ROOT password of MYSQL database set above. When you enter for the first time, you will be asked if you need to modify it and other settings. We can select the n/y option as required.
mysql -u root -p
create database laozuoorg;
grant all on laozuoorg.* to 'laozuouser' identified by 'laozuo.org';
Use root permission to enter MYSQL database, enter the password we set before, and then create the database name of Laozuo org, the data table of laozuouser, and the database password of laozuo.org.
Enter quit to exit MYSQL settings after creation.
Fourth, install and set 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) without changing it 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, we must install the following command of PHP5 MySQL package:
apt-get install php5-mysql
Start apache
service apache2 restart
In this way, through the above four steps, we can build the site and database. Later, we just need to upload the web program to / srv/www/idcxen.com/public_html, and then install it according to the prompts.
PS: if WORDPRESS is installed successfully in Laozuo, the only thing you need to pay attention to is that the root directory permission needs to be writable. htaccess or create a pseudo-static file manually, so that the background fixed connection settings take effect.
chown -R www-data:www-data /srv/www/