Nginx Build Command
Cd/home/oldboy/tools Installation and Storage package path
Yum install OpenSSL openssl-devel-y required libraries, and encryption protocols
Yum Install Pcre pcre-devel-y the required libraries, and encryption protocols for installing Nginx
Rpm-qa openssl-devel pcre-devel OpenSSL openssl-devel Check to see if it's installed.
Wget-q http://nginx.org/download/nginx-1.6.3.tar.gz Download Package
Useradd www-s/sbin/nologin-m Create user
Tar XF nginx-1.6.3.tar.gz decompression software
CD nginx-1.6.3
./configure--user=www--group=www--with-http_ssl_module--with-http_stub_status_module--prefix=/application/ NGINX-1.6.3/Compiling and installing
Make
Make install
Ln-s/application/nginx-1.6.3//application/nginx
/application/nginx/sbin/nginx Open Service
Ps-ef|grep nginx Check
Create a Web page directory
[[email protected] html]# mkdir {www,bbs,blog}-P
[Email protected] www]# echo "www.etiantian.org" >index.html
Modifying the master configuration file
Add access logs and virtual host directories
Log_format Main ' $remote _addr-$remote _user [$time _local] "$request" '
' $status $body _bytes_sent ' $http _referer '
' "$http _user_agent" "$http _x_forwarded_for";
#nginx vhosts Config
Include extra/www.conf;
Include extra/bbs.conf;
Include extra/blog.conf;
Create the directory hosting the virtual host
[Email protected] conf]# mkdir extra
[email protected] extra]# Touch www.conf
[email protected] extra]# Touch bbs.conf
[email protected] extra]# Touch blog.conf
Modify the Conf directory for each virtual host
server {
Listen 80;
server_name www.etiantian.org etiantian.org;
Location/{
Root html/www;
Index index.html index.htm;
}
Access_log Logs/access_www.log Main;
}
Set boot up
[Email protected] oldboy]# echo "/application/nginx/sbin/nginx" >>/etc/rc.local
[Email protected] oldboy]# tail-1/etc/rc.local
/application/nginx/sbin/nginx
MySQL build command
Install MySQL
Upload MySQL
LS mysql-5.5.49-linux2.6-x86_64.tar.gz
Tar XF mysql-5.5.49-linux2.6-x86_64.tar.gz
Mkdir/application-p
MV mysql-5.5.49-linux2.6-x86_64/application/mysql-5.5.49
Ln-s/application/mysql-5.5.49/application/mysql
Useradd mysql-s/sbin/nologin-m Create user and authorization directory
Chown-r mysql.mysql/application/mysql/Create user and authorization directory
Cd/application/mysql
./scripts/mysql_install_db--user=mysql--basedir=/application/mysql--datadir=/application/mysql/data/Initialization database
ll data/
\CP SUPPORT-FILES/MY-SMALL.CNF/ETC/MY.CNF Creating basic requirements
CP Support-files/mysql.server/etc/init.d/mysqld Creating Basic requirements
chmod +x/etc/init.d/mysqld to execute permissions
Sed-i ' s#/usr/local/mysql#/application/mysql#g '/application/mysql/bin/mysqld_safe/etc/init.d/mysqld modifying configuration files
/etc/init.d/mysqld Start Open Service,
Netstat-lntup|grep MySQL Check
echo "Path="/application/mysql/bin: $PATH "" >>/etc/profile
Chkconfig--add mysqld Open Service
Chkconfig mysqld on open service
Cp-a/application/mysql/bin/*/usr/local/sbin/
Ln-s/application/mysql/bin/*/usr/local/sbin/
Mysql
1. Install PHP Base Library
Yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel-y
Yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel-y
Rpm-qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel Libcurl-devel Libxslt-devel
A supported package needs to be installed first
Cd/home/oldboy/tools
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 install
Cd.. /
2. PHP Related Extension Library
Wget-o/etc/yum.repos.d/epel.repo Http://mirrors.aliyun.com/repo/epel-6.repo
Yum-y Install Libmcrypt-devel
Yum-y Install Mhash
Yum-y Install MCrypt
Rpm-qa Libmcrypt-devel Mhash MCrypt
Unzip the PHP installation package, edit
Uploading PHP Packages
Tar XF php-5.5.32.tar.gz unzip PHP installation package
./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-rpath \
--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-USER=WWW \
--WITH-FPM-GROUP=WWW \
--ENABLE-FTP \
--enable-opcache=no
Ln-s/application/mysql/lib/libmysqlclient.so.18/usr/lib64/
Touch Ext/phar/phar.phar
Make
Make install
Ln-s/application/php5.5.32//application/php
ls/application/php/
CP Php.ini-production/application/php/lib/php.ini
Configuring PHP Parsing files
CP Php.ini-production/application/php/lib/php.ini
Configuring the PHP-FPM configuration file
CP Php-fpm.conf.default php-fpm.conf
Start PHP-FPM
/application/php/sbin/php-fpm
Lsof-i: 9000
Ps-ef|grep PHP-FPM
[email protected] extra]# cat blog.conf
server {
Listen 80;
server_name blog.etiantian.org;
Location/{
Root Html/blog;
Index index.html index.htm;
}
Location ~. *\. (PHP|PHP5)? $ {
Root Html/blog;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Include fastcgi.conf;
}
}
[Email protected] extra]#. /.. /sbin/nginx-t
Nginx:the configuration file/application/nginx-1.6.3//conf/nginx.conf syntax is OK
Nginx:configuration file/application/nginx-1.6.3//conf/nginx.conf Test is successful
[Email protected] extra]#. /.. /sbin/nginx-s Reload
[email protected] blog]# cat test_mysql.php
<?php
$link _id=mysql_connect (' localhost ', ' root ', ' oldboy123 ') or mysql_error ();
if ($link _id) {
echo "MySQL successful by Oldboy!";
}else{
Echo Mysql_error ();
}
?>
Build a blog command
Mysql-uroot-poldboy123
Create DATABASE WordPress;
show databases;
Grant all on wordpress.* to [email protected] ' localhost ' identified by ' 123456 ';
Select User,host from Mysql.user;
Show grants for [email protected] ' localhost ';
Flush privileges;
Download the blog Installation
wget https://cn.wordpress.org/wordpress-4.5.1-zh_CN.tar.gz
ll
Tar XF wordpress-4.5.1-zh_cn.tar.gz
LS WordPress
Cp-a wordpress/*/application/nginx/html/blog/
ls/application/nginx/html/blog/
Chown-r www.www/application/nginx/html/blog/
ls/application/nginx/html/blog/
ls/application/nginx/html/blog/-L
History
Detach command
Wed command
mysqldump-uroot-poldboy123 Wordpress-b |gzip>bak.sql.gz
SCP bak.sql.gz [Email protected]:/tmp
Database MySQL command
Cd/tmp
Gzip XF bak.sql.tar.gz
Mysql-uroot-poldboy123-e "Show databases like ' WordPress ';"
Mysql-uroot-poldboy123-e "use wordpress;show tables;"
Mysql-uroot-poldboy123
Grant all on wordpress.* to [e-mail protected] ' 172.16.1.% ' identified by ' 123456 ';
Flush privileges;
Select User,host from Mysql.user;
Change. 8 Configuration file wp-config.php
Define (' Db_host ', ' 172.16.1.51 ');
Close the Local database
/etc/init.d/mysqld stop
Chkconfig mysqld off
Success.
2. Migrating the blog's Resource Files to NFS
[Email protected] blog]# tree wp-content/uploads/
The Resource directory is: wp-content/uploads/
NFS Commands
echo "/uploads 172.16.1.0/24 (rw,sync)"/etc/exports
MySQL Database command
Mount-t NFS 172.16.1.31:/uploads/application/nginx/html/blog/
According to the old boy teacher's explanation, and the actual operation to build up
This article is from the "11255195" blog, please be sure to keep this source http://11265195.blog.51cto.com/11255195/1774901
LNMP Blog and database separation and build the actual combat