实验一:搭建wordpress
yum -y install bash-completion nginx
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php72w-tidy php72w-common php72w-devel php72w-pdo php72w-mysqlnd php72w-gd php72w-ldap php72w-mbstring php72w-mcrypt php72w-fpm
systemctl enable php-fpm
systemctl enable nginx
systemctl start php-fpm
systemctl start nginx
vi /etc/nginx/nginx.conf
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
cd /usr/share/nginx/html/
wget https://wordpress.org/wordpress-5.4.10.zip
unzip wordpress-5.4.10.zip
chmod -R 777 wordpress
cd wordpress
cp wp-config-sample.php wp-config.php
vi wp-config.php
/** The name of the database for WordPress */
define( ‘DB_NAME’, ‘数据库名字’ );
/** MySQL database username */
define( ‘DB_USER’, ‘数据库用户名’ );
/** MySQL database password */
define( ‘DB_PASSWORD’, ‘数据库密码’ );
/** MySQL hostname */
define( ‘DB_HOST’, ‘RDS的IP:端口号’ );
/** Database Charset to use in creating database tables. */
define( ‘DB_CHARSET’, ‘utf8’ );
/** The Database Collate type. Don’t change this if in doubt. */
define( ‘DB_COLLATE’, ” );
define( ‘FS_METHOD’, ‘direct’ ); #加这一行是为了安装时候有中文
define( ‘FS_CHMOD_DIR’, 0777 );
define( ‘FS_CHMOD_FILE’, 0777 );
源码安装php-redis
wget https://github.com/phpredis/phpredis/archive/develop.zip
unzip develop.zip
cd phpredis-develop
phpize
./configure -with-php-config=/usr/bin/php-config
make && make install
define( ‘WP_REDIS_PORT’, ‘6379’ );
define( ‘WP_REDIS_HOST’, ‘ip’ );
define( ‘WP_REDIS_PASSWORD’, ‘o0o0o0o0’ );
vi /etc/php.ini
extension_dir = “/usr/lib64/php/modules”
vi /etc/php.d/redis.ini
extension = redis.so