A. Turn off the firewall and SElinux
systemctl stop firewalld.service
setenforce 0
Second, create / data / server for file storage analysis:
mkdir /data/server
Three install nginx source code
download and unzip NGINX:
wget http://nginx.org/download/nginx-1.16.0.tar.gz
Download dependencies:
yum install openssl openssl-devel zlib zlib-devel pcre pcre-devel gcc gcc-c++ -y
Into the directory:
cd /usr/local/src/nginx-1.16.0
Compile and install:
./configure --prefix=/data/server/nginx #(编译安装的路径,将服务都放在/data/server下)
make && nake install
NGINX compiled into the next, start NGINX
cd /data/server/nginx/sbin
./nginx
Check your IP
ifconfig
Found in the browser enter the IP
NGINX compiled
IV. Source install mysql
Download Source Package
unzip
unzip AliSQL-AliSQL-5.6.32-9.zip
Download the package depend on the environment:
yum -y install cmake bison git ncurses-devel gcc gcc-c++
Add a user:
groupadd MySQL
useradd -g MySQL MySQL
installation and then extract the perl:
wget http://repo.openfusion.net/centos7-x86_64//perl-Data-Dumper-2.154-1.of.el7.x86_64.rpm
rpm -ivh http://repo.openfusion.net/centos7-x86_64//perl-Data-Dumper-2.154-1.of.el7.x86_64.rpm
Unzip into a good directory
cd AliSQL-AliSQL-5.6.32-9/
Then compile and install:
cmake -DCMAKE_INSTALL_PREFIX=/data/server/mysql -DMYSQL_UNIX_ADDR=/data/server/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/data/server/mysql/data -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DENABLE_DOWNLOADS=1
make && make install
Modify the main directory permissions:
chown -R mysql:mysql /data/server/mysql
Copy the file to privileges:
cd /data/server/mysql
cp support-files/my-default.cnf ./my.cnf
chown -R mysql:mysql my.cnf
Profiles
vim my.cnf
basedir = /data/server/mysql
datadir = /data/server/mysql/data
socket = /data/server/mysql/mysql.sock
log-error= /data/server/mysql/data/error.log
pid-file = /data/server/mysql/data/mysql.pid
user = mysql
tmpdir = /tmp
Database initialization
scripts/mysql_install_db --defaults-file=./my.cnf --user=mysql
Start the database
support-files/mysql.server start
PID error to start the database solution:
rm -rf /etc/my.cnf
rm -rf my.conf
cd data
rm -rf *
cd ..
scripts/mysql_install_db --defaults-file=./my.cnf --user=mysql
cd support-files/
./mysql.server start
cd ..
cd bin
Restart the database:
support-files/mysql.server start
Create a database:
>create database wordpress;
>grant all on wordpress.* to wordpress@'localhost' identified by'123456';
>flush privileges;
>exit
mysql installed.
V. Installation Source PHP:
Adding users:
groupadd www
useradd -g www -s /sbin/nologin -M www
Installation package depended:
yum the install the libpng zlib libxml libjpeg FreeType Gd-devel curl libiconv the libxml2-devel zlib libjpeg-devel FreeType the libpng-devel devel-Gd-curl-devel devel OpenSSL OpenSSL-devel the libxslt -Y-devel
installed libiconv, unzip :
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
tar zxf libiconv-1.15.tar.gz
File into libiconf
cd libiconv-1.15
Compile libiconv
./configure --prefix=/data/server/libiconv
make && make install
Download and extract the PHP:
tar -zxvf php-5.6.32.tar.gz
Advance to the next file php-5.6.30
cd /data/server/php-5.6.30
Compile
./configure \
--prefix=/data/server/php \
--enable-fpm \
--with-mysql=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-openssl \
--with-zlib \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-iconv=/data/server/libiconv \
--enable-short-tags \
--enable-sockets \
--enable-zend-multibyte \
--enable-soap \
--enable-mbstring \
--enable-static \
--with-curl \
--enable-ftp \
--with-libxml-dir
make && make install
php.ini configuration
cp php.ini-development /data/server/php/lib/php.ini
php-fpm configuration:
cp -R ./sapi/fpm/php-fpm.conf /data/server/php/etc/php-fpm.conf
Php will give us ready init.d.php-fpm backup
cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
Add the php-fpm service to chkconfig list
chkconfig --add php-fpm
Set boot from the start
chkconfig php-fpm on
Start Service
service php-fpm start
在这里会报错:Permission Denied
vim /etc/profile #(在末尾加)
PATH=$PATH:$HOME/bin:/data/server/php56/bin
source /etc/profile #(使环境生效)
设置开机自启动
chkconfig --add php-fpm
加权限
chkconfig php-fpm on
启动php-fpm
service php-fpm start
更改配置文件:
vim /data/server/nginx/conf/nginx.conf
将user 前面注释去掉 并将nobady改成www www
在server/location模块下的index栏下 加一个 index.php
![](https://s1.51cto.com/images/blog/201908/09/314bd443ebe1d4f5cd2d670458248004.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
将location ~ \.php$ 模块注释去掉 并/scripts改成$document_root
去到html目录下
cd /data/server/nginx/html
添加test.php文件
vim test.php
<?php phpinfo() ; ?
进到nginx运行目录
cd /data/server/nginx/sbin
重读nginx
./nginx -s reload
在浏览器里输入 ip/test.php
PHP set up is completed
VI. To build a wordpress
download wordpress and unzip
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz
tar -zxvf wordpress-4.9.4-zh_CN.tar.gz
the wordpress files copied to the page directory
cp -r wordpress / data / server / nginx / html
modify Wordpress profile
cd / data / server / nginx / html / wordpress
copy profile
cp -r wp-config-sample.php wp -config.php
modify config.php-WP
vim WP-config.php
where you can modify
the database name, account number, password (where modification of the database is created in the name mysql, user, password)
and then into the host 127.0.0.1 (you can set your own access )