Record it so that you do not forget it.
1. Install nginx.
Nginx-1.4.5. :
Http://nginx.org/download/nginx-1.4.5.tar.gz
(Check whether a pcre exists before installation. If not, run yum .)
Download and decompress the package. Create the user www and User Group www.
Groupadd wwww # Add a www Group
Useradd-s/sbin/nologin-g www # Add www to the www group and set that you cannot log on
Start installation:
./Configure -- user = www -- group = www \ # Run the nginx process as the www user
-- Prefix =/var/app/nginx \ # specify the installation directory
-- With-http_stub_status_module # Install nginx Status view Module
# After configuration is complete
Make & makeinstall
After installation is complete, nginx will be configured later, and mysql will be installed later.
2. Install mysql.
Download mysql. Download link:
Http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.3-m13.tar.gz
Use cmake to replace configure configuration from mysql5.5. You need to install cmake first. To avoid compilation errors, install ncurses-devel.
Add a user group and user for mysql and start installation:
Cmake-DCMAKE_INSTALL_PREFIX =/var/app/mysql \ # configure the default installation path
-DDEFAULT_CHARSET = utf8 \ # configure the default database Encoding
-DDEFAULT_COLLATION = utf8_general_ci \ # default database Encoding
-DWITH_EXTRA_CHARSETS: STRING = utf8, gb2312, gbk \ # Extensions support encoding (all | utf8, gbk, gb2312 | none)
-DWITH_MYISAM_STORAGE_ENGINE = 1 \## MYISAM storage engine support (1 | 0)
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \## INNOBASE storage engine support (1 | 0)
-DWITH_MEMORY_STORAGE_ENGINE = 1 \## MEMORY storage engine support (1 | 0)
-DWITH_READLINE = 1 \## shortcut key function
-DENABLED_LOCAL_INFILE = 1 \## allow local data import
-DMYSQL_DATADIR =/var/mysql/data \ # data storage path
-DMYSQL_USER = mysql # Database startup user
# After configuration is complete
Make & makeinstall
Copy my. cnf under support-files to/etc, copy mysql. server under support-files to/etc/init. d/mysqld, and add the execution permission as the startup script.
Initialize Database
# Enter the mysql installation directory for execution
./Scripts/mysql_install_db -- basedir =/var/app/mysql \ # specify the mysql main directory
-- Datadir =/var/app/data \ # specify the mysql data storage directory and change the directory owner to the mysql startup user
-- User = mysql # specify the mysql startup user
After successful initialization, enable mysql and set the password for the root user:
/Var/app/mysql/bin/mysql admin-u root password "123123"
After installing mysql, start the service:
/Etc/init. d/mysqldstart
3. install PHP
Download php. Download link:
Http://us1.php.net/get/php-5.3.28.tar.gz/from/this/mirror
.
Install the dependency package before installing php, and directly install yum:
Yum installgd gd-devel libxml2.x86 _ 64 libxml2-devel.x86_64
Start installation:
# Install these extensions as needed. If it is based on nginx + php-fpm, -- enable-fpm must be written
./Configure -- prefix =/var/app/php -- with-config-file-path =/var/app/php/etc \
-- With-mysql =/var/app/mysql -- with-mysqli =/var/app/mysql/bin/mysql_config \
-- With-freetype-dir -- with-jpeg-dir -- with-png-dir -- with-gd -- enable-mbstring \
-- With-zlib -- with-libxml-dir =/usr -- enable-xml -- with-curl -- enable-zip \
-- Enable-sockets -- with-mhash -- enable-fpm
# Start compilation and installation after Successful Configuration
Make & makeinstall
Copy the php. ini-production to the/var/app/php/etc directory and rename it as php. ini, rename the php-fpm.conf.default under/var/app/php/etc to the php-fpm.conf, modify the following content:
Vim php-fpm.conf.
[Www]
Listen 127.0.0.1: 9000 # Set the address for receiving the request, which will be used in nginx. conf
Listen. allowed_clients 127.0.0.1 # sets the ip addresses allowed to connect to php-fpm. Each address is separated by commas.
Listen. owner www # Set the listener user
Listen. group www # Set the listening group
Listen. mode 0666 # Set Unix socket permissions. Read and Write Permissions must be set.
User www # process running user
Group www # user group for Running Processes
Pm dynamic # set the process startup mode. Available values: static and dynamic
Pm. max_children 15 # Number of sub-processes. When pm is set to static, it indicates the number of processes started. When pm is set to dynamic, it indicates the maximum number of processes.
Pm. start_servers 15 # Number of processes at startup. It is only used when pm is set to dynamic.
Pm. min_spare_servers 5 # minimum number of processes. used only when pm is set to dynamic
Pm. max_spare_servers 25 # maximum number of processes. used only when pm is set to dynamic
Pm. max_requests 500 # set the number of service requests before each sub-process is reborn. If it is set to '0', requests are always accepted.
# Pm dynamic Process Calculation formula: min_spare_servers + (max_spare_servers-min_spare_servers)/2
The simple configuration of php-fpm is complete. Start the service:
/Var/app/php-fpm
Modify nginx configuration file
Vim/var/app/nginx/conf/nginx. conf
# Simply modify it to test whether the environment is correct
User webuser www;
Server
{
Listen 80;
Server_name 127.0.0.1;
Index index.html index.htm index. php;
Root/var/www/html;
Location ~ . * \. Php? $
{
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Include fastcgi. conf;
}
Write a php test file info. php
<? Php
Phpinfo ();
?>
Start the nginx Service
/Var/app/nginx/sbin/nginx
Open the site to check whether the phpinfo page exists.
Installation is complete.
Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04
Build and install the LNMP production environment in CentOS 6.4
Practical Production Environment-LNMP architecture compilation and installation + SSL encryption implementation
LNMP full-featured compilation and installation for CentOS 6.3 notes
Install LNMP in CentOS 6.3 (PHP 5.4, MyySQL5.6)
Nginx startup failure occurs during LNMP deployment.
Ubuntu install Nginx php5-fpm MySQL (LNMP environment setup)