1.1 web服务器上nginx的部署
yum install -y pcre-devel openssl-devel
mkdir -p /server/tools
cd /server/tools/
wget http://nginx.org/download/nginx-1.14.0.tar.gz
tar xf nginx-1.14.0.tar.gz
cd nginx-1.14.0
useradd -s /sbin/nologin www -M
./configure --user=www --group=www --prefix=/application/nginx-1.14.0/ --with-http_stub_status_module --with-http_ssl_module --with-pcre
make & make install
ln -s /application/nginx-1.14.0/ /application/nginx
cd /application/nginx/conf
egrep -v "#|^$" nginx.conf.default >nginx.conf
/application/nginx/sbin/nginx
1.2 MySQL服务器的部署
mkdir -p /server/tools
mkdir /application
cd /server/tools/
tar xf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz
useradd -s /sbin/nologin -M mysql
mv mysql-5.6.40-linux-glibc2.12-x86_64 /application/mysql-5.6.40
ln -s /application/mysql-5.6.40 /application/mysql
chown -R mysql.mysql /application/mysql/data/
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
cp -a /application/mysql/support-files/mysql.server /etc/init.d/mysqld
sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
/bin/cp /application/mysql/support-files/my-default.cnf /etc/my.cnf
/etc/init.d/mysqld start
/application/mysql/bin/mysqladmin -u root password '123456'
echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile
source /etc/profile
1.3 web服务器上PHP服务器的部署
yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel libmcrypt-devel mhash mcrypt -y
cd /server/tools/
tar xf php-5.6.36.tar.gz
cd php-5.6.36
./configure
--prefix=/application/php-5.6.36
--with-mysql=mysqlnd
--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
make && make install
ln -s /application/php-5.6.36/ /application/php
cd /server/tools/php-5.6.36
cp php.ini-production /application/php/lib/php.ini
cd /application/php/etc/
cp php-fpm.conf.default php-fpm.conf
/application/php/sbin/php-fpm
1.4 WordPress搭建博客程序(独立的MySQL服务器和nfs共享服务器)
unzip -o wordpress-4.9.4-zh_CN.zip
mkdir /application/nginx/html/blog
cd wordpress
mv ./* /application/nginx/html/blog/
cd /application/nginx/html/blog/
chown www.www -R /application/nginx/html/blog/
#手动改
server {
listen 80;
server_name blog.ms.com;
location / {
root html/blog;
index index.php index.html index.htm;
}
location ~* .*.(php|php5)?$ {
root html/blog;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
yum install -y nfs-utils
#mysql服务器
mysql -uroot -p123456
create database wordpress;
grant all on wordpress.* to 'wordpress'@'10.0.0.%' identified by '123456';
flush privileges;
#web01 web02
mkdir /application/nginx/html/blog/wp-content/uploads
mount -t nfs 172.16.1.31:/data /application/nginx/html/blog/wp-content/uploads/
#nfs 服务器
/data 172.16.1.0/24(rw,sync,root_squash,no_all_squash,anonuid=501,anongid=501)
chown -R www.www /data