The Lnamp (linux+nginx+apache+mysql+php) architecture has been favored by many IT companies, replacing the LNMP (linux+nginx+mysql+php) architecture that was previously considered good.
Then we say lnamp in the end there are any advantages, but also from Nginx and Apache of the advantages and disadvantages of speaking.
1) nginx processing static file ability is very strong
2) Apache processing dynamic files is very strong and stable, the two integrated in a piece, performance improved many times.
Perhaps a lot of Linux SA in the LNMP operation, you will find that PHP (FastCGI) mode will appear some 502 error phenomenon, because of the nginx+php (FastCGI) combination of instability caused by the cause.
Source installation of Lnamp Nginx
Yum install prce-devel-y;cd/usr/src; wget http://nginx.org/download/nginx-1.6.0.tar.gz; CD nginx-1.6.0;. /configure-prefix=/usr/local/nginx && make && make install
source installation Lnamp Apache
Yum install Apr-devel apr-util-devel–y;
CD/USR/SRC; wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.27.tar.gz; tar xzf httpd-2.2.27.tar.gz; CD httpd-2.2.27;. /configure--prefix=/usr/local/apache--enable-so--enable-rewrite && make&& make install
source installation Lnamp MySQL
CD/USR/SRC; wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.63.tar.gz; tar xzf mysql-5.1.63.tar.gz; CD mysql-5.1.63;. /configure--prefix=/usr/local/mysql--enable-assembler && make && make install
Configure the MySQL service for system services:
Cp/usr/local/mysql/share/mysql/my-medium.cnf/etc/my.cnf
Cp/usr/local/mysql/share/mysql/mysql.server/etc/rc.d/init.d/mysqld
Chkconfig--add mysqld
Chkconfig--level 345 mysqld on
Cd/usr/local/mysql
Useraddmysql
Chown-r Mysql.mysql/usr/local/mysql
/usr/local/mysql/bin/mysql_install_db--user=mysql
Chown-r mysql var
/usr/local/mysql/bin/mysqld_safe--user=mysql &
SOURCE Installation Lnamp PHP
CD/USR/SRC; wget http://mirrors.sohu.com/php/php-5.3.28.tar.bz2; tar jxf php-5.3.28.tar.bz2; CD php-5.3.28;. /configure--prefix=/usr/local/php5--with-config-file-path=/usr/local/php/etc--with-apxs2=/usr/local/apache/bin /apxs--with-mysql=/usr/local/mysql/
Source Installation apache+php Integration
Integrate the apache+php environment, modify the httpd.conf configuration file, and then add the following statement:
LoadModule php5_modulemodules/libphp5.so (default already exists)
AddType application/x-httpd-php. php
DirectoryIndex index.phpindex.html (before adding index.php to index.html)
Then create the index.php test page in the/usr/local/apache/htdocs directory and execute the following command:
cat>>/usr/local/apache/htdocs/index.php <<eof
<?php
Phpinfo ();
?>
Eof
Restarting the Apache service, through the IP access interface such as, represents the lamp environment to build success.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6D/0C/wKiom1VaviiTaV4mAAGH6OYXZBE196.jpg "title=" Qq20150519123813.jpg "alt=" Wkiom1vaviitav4maagh6oyxzbe196.jpg "/>
Source Installation Discuz Forum
Download the Discuz source package file and unzip it:
CD/USR/SRC, wget http://download.comsenz.com/DiscuzX/3.1/Discuz_X3.1_SC_UTF8.zip
Unzip Discuz package: Unzip discuz_x3.1_sc_utf8.zip-d/usr/local/apache/htdocs/
Rename program file: cd/usr/local/apache/htdocs/; MV upload/*.
Give Discuz directory full access rights: Cd/usr/local/apache/htdocs/;chmod 777-r data/uc_server/config/uc_client/
Then visit the IP installation discuz forum, for example, select "I Agree"
Enter the following interface, the database installation, if it does not exist, you need to create a new database and authorization.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6D/0C/wKiom1VavtiBKGpVAAHSZaumJT8047.jpg "title=" Qq20150519124006.jpg "alt=" Wkiom1vavtibkgpvaahszaumjt8047.jpg "/>
Click Next until the installation is complete and go to the long-awaited forum screen:
Since the lamp environment has been integrated and built successfully, how can you use Nginx to integrate lamp?
Source Installation Nginx+lamp Integration
First modify the Apache access port to 8080,nginx Port 80.
Then modify the Nginx configuration file: The Vi/usr/local/nginx/conf/nginx.conf,server configuration section reads as follows:
(Define upstream equalization module, configure dynamic and static separation, dynamically forward to Apache, static file directly local response)
Upstream App_lamp {
Server 127.0.0.1:8080 weight=1 max_fails=2 fail_timeout=30s;
}
server {
Listen;
server_name localhost;
Location/{
Root/usr/local/apache/htdocs;
Index index.php index.html index.htm;
}
Location ~. *\. (php|jsp|cgi)? $
{
Proxy_set_header Host $host;
Proxy_set_header x-real-ip$remote_addr;
Proxy_set_header x-forwarded-for$proxy_add_x_forwarded_for;
Proxy_pass Http://app_lamp;
}
Location ~.*\. (HTML|HTM|GIF|JPG|JPEG|BMP|PNG|ICO|TXT|JS|CSS) $
{
Root/usr/local/apache/htdocs;
Expires 3d;
}
}
Test, Access Nginx Ip+port as shown:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6D/06/wKioL1VawMmgAf14AADxuV2t__Y693.jpg "title=" Qq20150519124322.jpg "alt=" Wkiol1vawmmgaf14aadxuv2t__y693.jpg "/>
View system-initiated ports and processes such as:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6D/0C/wKiom1Vav5Kyr-XpAAUyCx6d4yA243.jpg "title=" Qq20150519124421.jpg "alt=" Wkiom1vav5kyr-xpaauycx6d4ya243.jpg "/>
Since then, lnamp all integrated, the next step is to optimize the system kernel, each service, architecture.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6D/06/wKioL1VawWfho3gkAAEzGWZyDUU515.jpg "title=" Qq20150519124558.jpg "alt=" Wkiol1vawwfho3gkaaezgwzyduu515.jpg "/>
This article is from the "Start from the Heart" blog, please be sure to keep this source http://hao360.blog.51cto.com/5820068/1652709
Lnamp (linux+nginx+apache+mysql+php) High Performance Architecture Configuration Combat Edition