The LNMP + WordPress environment built this time is as follows
MySQL | php |
---|---|
Wordpress 4.9 | nginx |
AMI2 | 172.31.91.2 |
1.Install MariaDB, PHP, nginx, WGet
2. Modify PHP FPM and nginx configuration files
3. Download WordPress and configure
4. The web page enters the background
1. Master configuration
sudo yum -y install mariadb mariadb-server php php-server wget php-fpm php-mysql
sudo amazon-linux-extras install -y nginx1
#Start nginx, MariaDB, and initialize mailadb
systemctl start mariadb
/usr/sbin/nginx
systemctl enable mariadb
systemctl enable nginx
mysql_secure_installation #Set the database root user password
2、Modify PHP-FPM configuration files
Edit PHP FPM configuration file
[root@localhost ~]# vi /etc/php-fpm.d/www.conf
## Modify the following lines file to change Apache to nginx
listen = /var/run/php-fpm.sock # add this
listen.owner = nginx # Modify line 32
listen.group = nginx # Modify line 33
user = nginx # Modify line40
group = nginx # Modify line42
## restart php
[root@localhost ~]# systemctl start php-fpm
3、Download WordPress and configure
# wget https://wordpress.org/wordpress-4.9.tar.gz
You can download it to the computer first and then transfer it to the server
Tar decompression package
tar -zxf wordpress-4.9.tar.gz
Log in to MySQL and create WordPress database and user
MariaDB [(none)]> create database `wordpress-db`;
MariaDB [(none)]> grant all privileges on `wordpress-db`.* to 'wordpress'@'localhost' identified by '000000';
MariaDB [(none)]> flush privileges;
Create and edit WP config PHP file
[root@server ~]# cp wordpress/wp-config-sample.php wordpress/wp-config.php
[root@server ~]# vi wordpress/wp-config.php
Modify database name, database user and password
Copy the contents of WordPress installation directory
#Remove page files from the original directory
mv /usr/share/nginx/html/* /opt/
cp -r wordpress/* /usr/share/nginx/html
#change permission
[root@localhost ~]# chown -R nginx:nginx /usr/share/nginx/
Restart nginx and MariaDB services
[root@server ~]# systemctl restart mariadb
[root@server ~]# /usr/sbin/nginx -s reload
Top comments (0)