LNMP combined environment

Mysql----binary installation:

download rpm package

Create MySQL user:

useradd -s /sbin/nologin mysql -M

When encountering a user that cannot be created here, it prompts: useradd: group mysql exists - if you want to add this user to

Solution reference: https://www.linuxidc.com/Linux/2012-03/56175.htm

id  mysql

Unzip the installation package:

tar xf mysql-5.5.55-linux2.6-x86_64.tar.gz

Create a soft link in the application directory of the mobile file

Database initialization:

View database:

Modify the startup file location: /application/mysql/bin/mysqld_safe

 

Initialize the configuration file /etc/my.cnf

Set environment variables:

You can directly access the Mysql database with mysql

Security configuration

Set password: mysqladmin -u root password '123456'

Change the password: mysqladmin -uroot -p123456 password 911216

View status: netstat -lntup|grep mysql

Set permanent startup: chkconfig --add mysqld

summary:

step:

FastCGI、PHP:

Check the environment:

The php program will call some function libraries such as zlib and gd when developing and running, so confirm whether the lib library has been installed. Execute the following commands:

rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel

rpm -qa freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel

Note: libjpeg-turbo-devel is the new name of the early libjpeg-devel, libcurl=devel is the new name of the early curl-devel

Install the required libs:

yum install zlib-devel libxml2-devel libjpeg-turbo-devel libiconv-devel -y

yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel -y

Remember to check after installation

The yum source does not have the libiconv-devel package and needs to be installed manually

the first method

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar zxf libiconv-1.14.tar.gz

cd libiconv-1.14

./configure --prefix=/usr/local/libiconv

make

make insatall

 

PHP related extension library

Third-party yum source: wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

yum -y install libmcrypt-devel mhash mcrypt

The PHP service starts to install:

cn.php.net

Download package: wget http://mirrors.sohu.com/php/php-5.3.27.tar.gz

Unzip: tar xf php-5.5.32.tar.gz

          cd php-5.5.32

Compile parameters:

           ./configure \

           --prefix=/application/php5.5.32 \

           --with-mysql=/application/mysql/ \

           --with-pdo-mysql-mysqlnd \

           --with-iconv-dir=/usr/local/libiconv \

           --with--freetype-dir \

           --with-jpeg-dir \

           --with-png-dir \

           --with-zlib \

           --with-libxml-dir=/usr \

           --enable-xml \

           --disable-repath \

           --enable-bcmath \

           --enable-shmop \

           --enable--sysvsem \

           --enable-inline-optimization \

           --with-curl\

           --enable-mbregex \

           --enable-fpm \

           --enable-mbstring \

           --with-mcrypt\

           --with-gd\

           --enable-gd-native-ttf \

           --with-openssl \

           --with-mhash \

           --enable-pcntl \

           --enable-sockets \

           --with-xmlrpc \

           --enable-soap \

           --enable-short-tags \

           --enable-static \

           --with-xsl \

           --with-fpm-usr=www \

           --with-fpm-group=www \

           --enable-ftp \

           --enable-opcache=no                                                               

Solve the problems that will occur in configure and make:

ln -s /aplication/mysql/lib/libmysqlclient.so.18 /usr/lib64/

touch ext / phar / phar.phar

make compile

make install compile and install

ln -s /application/php5.5.32/ /application/php

configuration file

cp php.ini-production /application/php/lib/php.ini

cp php-fpm.conf.default php-fpm.conf

/application/php/sbin/php-fpm

cd /application/php/etc

 

Configure location (nginx+php)

restart nginx

www directory: echo "<?php phpinfo(); ?>" >test_info.php 

                      cat test_info.php

 

Configure mysql+php connection test:

Under the www directory:

Go here: The LNMP environment combination is completed.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324639483&siteId=291194637