1、编译安装搭建wordpress
1)编译安装nginx
yum -y install gcc gcc-c++ autoconf automake make wget vim
yum -y install openssl openssl-devel libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed libtool zlib zlib-devel pcre pcre-devel patch
yum -y install libxml2 libxml2-dev
yum -y install libxslt-devel
yum -y install perl-devel perl-ExtUtils-Embed
yum install bzip2 bzip2-devel -y
yum -y install libjpeg-devel -y
yum install libpng -y
yum install libpng-devel -y
yum install freetype-devel -y
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_dav_module --with-http_flv_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_stub_status_module --with-http_sub_module --with-http_random_index_module --with-http_degradation_module --with-http_secure_link_module --with-http_gzip_static_module --with-http_perl_module --with-pcre=../pcre-8.42 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.1.1-pre8 --with-file-aio --with-mail --with-mail_ssl_module --with-stream --with-ld-opt="-Wl,-E" --add-module=../nginx-sticky-module --add-module=../nginx_vts
vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
2)编译安装php
./configure -prefix=/usr/local/php -with-config-file-path=/usr/local/php/etc -with-bz2 -with-curl -enable-ftp -enable-sockets -disable-ipv6 -with-gd -with-jpeg-dir=/usr/local -with-png-dir=/usr/local -with-freetype-dir=/usr/local -enable-gd-native-ttf -with-iconv-dir=/usr/local -enable-mbstring -enable-calendar -with-gettext -with-libxml-dir=/usr/local -with-zlib -with-pdo-mysql=mysqlnd -with-mysqli=mysqlnd -with-mysql=mysqlnd -enable-dom -enable-xml -enable-fpm -with-libdir=lib64 -enable-bcmath --with-openssl
vim /usr/lib/systemd/system/php-fpm.service
[Unit]
Description=php-fpm
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/usr/local/php/sbin/php-fpm
ExecStop=/usr/bin/pkill php-fpm
PrivateTmp=false
[Install]
WantedBy=multi-user.target
cp ./php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
确保phpinfo()显示正常。
3)安装数据库
yum install wget -y
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum localinstall mysql57-community-release-el7-7.noarch.rpm -y
yum install mysql-community-server -y
systemctl start mysqld
systemctl enable mysqld
grep 'temporary password' /var/log/mysqld.log
2019-06-09T11:00:52.630626Z 1 [Note] A temporary password is generated for root@localhost: YHORQsfC_1,D
mysql_secure_installation
define( 'DB_NAME', 'wordpress' );
/** MySQL database username */
define( 'DB_USER', 'wordpress' );
/** MySQL database password */
define( 'DB_PASSWORD', '数据库密码' );
/** MySQL hostname */
define( 'DB_HOST', '127.0.0.1' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
2、搭建php-admin
下载phpMyAdmmin上传至服务器
登录phpMyAdmin报错mysqli_real_connect(): (HY000/2002): No such file or directory
mv config.sample.inc.php config.inc.php
$cfg['Servers'][$i]['host'] = '127.0.0.1';
安装成功。