Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Realization of wordpress by Modular LAMP and fpm LAMP

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The combination of Linux+Apache+Mysql/MariaDB+Perl/PHP/Python is often used to build open source software for dynamic websites or servers. With the vigorous development of the open source trend, open source LAMP has formed a tripod with J2EE and .net commercial software, and the software platform has a low cost of investment in software. LAMP platform has become the most powerful WEB website solution. Today, let's try modular LAMP and fpm LAMP to build dynamic websites.

Part one: modular LAMP to implement wordpress

The compilation and installation process of Apache2.4.18+mysql-5.5.33+php-5.4.26:

First, compile and install apache2.4.18

To ensure that the compilation process goes smoothly, solving the dependency httpd-2.4.18 first requires newer versions of the apr, apr-util, and pcre-devel packages, so you need to upgrade it in advance. There are two ways to upgrade, one is to compile and install through the source code, and the other is to upgrade the rpm package directly. Here apr and apr-util choose to compile the source code. Because pcre-devel is integrated into the red distribution, I install yum directly here.

Step 1: compile and install apr

# tar xf apr-1.5.0.tar.bz2# cd apr-1.5.0#. / configure-- prefix=/usr/local/apr# make & & make install

Step 2: compile and install apr-util

123 tar xf apr-util-1.5.3.tar.bz2# cd apr-util-1.5.3#. / configure-- prefix=/usr/local/apr-util-- with-apr=/usr/local/apr# make & & make install

Step 3: yum install pcre-devel

Yum install-y pcre-devel

Step 4: compile and install httpd-2.4.18

123 tar xf httpd-2.4.18.tar.bz2# cd httpd-2.4.18#. / configure-- prefix=/usr/local/apache-- sysconfdir=/etc/httpd24-- enable-so-- enable-ssl-- enable-cgi-- enable-rewrite-- with-zlib-- with-pcre-- with-apr=/usr/local/apr-- with-apr-util=/usr/local/apr-util-- enable-modules=most-- enable-mpms-shared=all-- with-mpm=event# make & & make install

After the compilation and installation is successful, in order to better use the httpd service, you need to configure it in four steps:

The first step is to modify the main configuration file of httpd and set the path of its Pid file

Edit / etc/httpd/httpd.conf and add the following line:

PidFile "/ var/run/httpd.pid"

The second step is to provide service startup script / etc/rc.d/init.d/httpd

The third step is to grant execution permissions to this script:

Chmod + x / etc/rc.d/init.d/httpd

Step 4, add to the list of services:

Chkconfig-add httpd

Then I can start the service.

Service httpd start

Second, install MySQL-5.5.33

Because the MySQL database source code file is too large and the compilation process is extremely slow, I do not intend to compile and install the source code here, but use the compiled MySQL directly. Even if the MySQL has been compiled, we still need to set the system environment as follows:

Step 1: prepare the data file storage directory, of course, the data file can be stored on a separate disk, or create a logical volume on a disk, here I only use the / data/mydata/ created under the root file as the storage path for the data file

Step 2: create the running user of mysql and assign the owner of the data file directory to mysql

1250 groupadd-r mysql# useradd-g mysql-r-s / sbin/nologin-M-d / mydata/data mysql# chown-R mysql:mysql / mydata/data

Step 3: install and initialize mysql-5.5.33

123456 tar xf mysql-5.5.33-linux2.6-i686.tar.gz-C / usr/local# cd / usr/local/# ln-sv mysql-5.5.33-linux2.6-i686 mysql# cd mysql# chown-R mysql:mysql. # scripts/mysql_install_db-- user=mysql-- datadir=/mydata/data# chown-R root.

Step 4: provide the main configuration file for mysql

12# cd / usr/local/mysql# cp support-files/my-large.cnf / etc/my.cnf

And modify the value of thread_concurrency in this file to multiply the number of your CPU by 2. For example, use the following line here:

Thread_concurrency = 2

You also need to add the location of the mysql data file as specified in the following line:

Datadir = / mydata/data

Step 5: provide sysv service scripts for mysql:

12 cd / usr/local/mysql# cp support-files/mysql.server / etc/rc.d/init.d/mysqld# chmod + x / etc/rc.d/init.d/mysqld

Add to the list of services:

Chkconfig-add mysqld

Chkconfig mysqld on

In order to install mysql in accordance with the system usage specifications and export its development components to the system for use, you also need to perform the following steps:

Step 6: output the man manual of mysql to the search path of the man command:

Edit / etc/man.config and add the following line:

MANPATH / usr/local/mysql/man

Then you can start the service test to use

3. Compile and install php5.4.26

Step 1: resolve dependencies

After configuring the yum source (system installation source and epel source), execute the following command:

1 yum-y groupinstall "Desktop Platform Development" # yum-y install bzip2-devel libmcrypt-devel

Step 2: compile and install php-5.4.26

12345 tar xf php-5.4.26.tar.bz2# cd php-5.4.26#. / configure-- prefix=/usr/local/php-- with-mysql=/usr/local/mysql-- with-openssl-- with-mysqli=/usr/local/mysql/bin/mysql_config-- enable-mbstring-- with-freetype-dir-- with-jpeg-dir-- with-png-dir-- with-zlib-- with-libxml-dir=/usr-- enable-xml-- enable- Sockets-with-apxs2=/usr/local/apache/bin/apxs-with-mcrypt-with-config-file-path=/etc-with-config-file-scan-dir=/etc/php.d-with-bz2-enable-maintainer-zts# make# make test# make intall

Step 3: install xcache

1234 tar xf xcache-3.0.3.tar.gz# cd xcache-3.0.3# / usr/local/php/bin/phpize#. / configure-- enable-xcache-- with-php-config=/usr/local/php/bin/php-config# make & & make install

Step 4: configuration and testing

Edit the apache configuration file httpd.conf to support php with apache

# vim / etc/httpd/httpd.conf

Add the following two lines

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

Navigate to DirectoryIndex index.html

Modified to:

DirectoryIndex index.php index.html

Provide a configuration file for php:

# cp php.ini-production / etc/php.ini

Next, edit / etc/php.d/xcache.ini, find the line at the beginning of zend_extension, and modify it as follows:

Zend_extension = / usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so

An example of the test page index.php is as follows:

123456789

If you visit the page and see Success, it means that our php and mysql are working properly.

Fourth, install wordpress

123#tar xf wordpress-4.4.2-zh_CN.zip#cd wordpress-4.4.2#vim wp-config.php

Change the name of the connection database, the user who connects to the database and the password, and access the page address we defined

If the following page appears, it shows that our configuration file has been modified successfully.

Part two: the implementation of wordpress with fpm LAMP

1. The installation of apache and MySQL is the same as the previous part; please install it according to it

II. Compile and install php-5.4.26

Step 1: resolve dependencies

After configuring the yum source (system installation source and epel source), execute the following command:

1 yum-y groupinstall "Desktop Platform Development" # yum-y install bzip2-devel libmcrypt-devel

Step 2: compile and install php-5.4.26

123 tar xf php-5.4.26.tar.bz2# cd php-5.4.26#. / configure-- prefix=/usr/local/php5-- with-mysql=/usr/local/mysql-- with-openssl-- with-mysqli=/usr/local/mysql/bin/mysql_config-- enable-mbstring-- with-freetype-dir-- with-jpeg-dir-- with-png-dir-- with-zlib-- with-libxml-dir=/usr-- enable-xml-- enable- Sockets-enable-fpm-with-mcrypt-with-config-file-path=/etc-with-config-file-scan-dir=/etc/php.d-with-bz2# make & & make install

Step 3: provide a configuration file for php:

1# cp php.ini-production / etc/php.ini

Step 4: configure php-fpm

Provide a SysV init script for php-fpm and add it to the service list:

123 cp sapi/fpm/init.d.php-fpm / etc/rc.d/init.d/php-fpm# chmod + x / etc/rc.d/init.d/php-fpm# chkconfig-- add php-fpm# chkconfig php-fpm on

Step 5: provide the configuration file for php-fpm and edit the configuration file of php-fpm

12# cp / usr/local/php/etc/php-fpm.conf.default / usr/local/php/etc/php-fpm.conf # vim / usr/local/php/etc/php-fpm.conf

Configure the relevant options for fpm to the values you need, and enable the pid file (the last line below):

12345pm.max_children = 50pm.start_servers = 5pm.min_spare_servers = 2pm.max_spare_servers = 8pid = / usr/local/php/var/run/php-fpm.pid

Step 6: then you can start php-fpm

Service php-fpm start

Use the following command to verify (if there are several php-fpm processes in the output of this command, the startup is successful):

Ps aux | grep php-fpm

3. Configure httpd-2.4.18

Step 1: enable the relevant modules of httpd

Since Apache httpd 2.4there has been a special module for the implementation of FastCGI, this module is mod_proxy_fcgi.so, it is actually an extension of the mod_proxy.so module, so both modules have to be loaded

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

Step 2: configure virtual hosts to support the use of fcgi

Add two lines similar to the following in the corresponding virtual host.

ProxyRequests Off

ProxyPassMatch ^ / (. *\ .php) $fcgi://127.0.0.1:9000/PATH/TO/DOCUMENT_ROOT/$1

Step 3: edit the apache configuration file httpd.conf so that apache can recognize the page in php format and support the home page in php format

Vim / etc/httpd/httpd.conf

1. Add the following two lines

2. Navigate to DirectoryIndex index.html

Modified to:

DirectoryIndex index.php index.html

Fourth, install wordpress

123#tar xf wordpress-4.4.2-zh_CN.zip#cd wordpress-4.4.2#vim wp-config.php

Change the name of the connection database, the user who connects to the database and the password, and access the page address we defined

If the following page appears, it shows that our configuration file has been modified successfully.

The so-called high-rise, any large project or platform is from easy to difficult, from simple to responsible, even Taobao such a large platform is initially just a simple LAMP platform development, so proficient in LAMP architecture is also a necessary quality for every operation and maintenance personnel, so that there will be better development on a larger stage.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report