Main information Reference: HTTPS://WWW.DIGITALOCEAN.COM/COMMUNITY/TUTORIALS/HOW-TO-INSTALL-LINUX-NGINX-MYSQL-PHP-LEMP-STACK-ON-CENTOS-7
1, install Nginx:
Yum install Nginx with yum installation
Systemctl Start Nginx Open Nginx
Systemctl enable Nginx follow-up system
2. Install MySQL (MariaDB)
Yum install mariadb-server mariadb using Yum installation
Systemctl Start mariadb Startup database
Systemctl Enable MARIADB Boot
Mysql_secure_installation Set security Policy, ask the following 5 questions
A) set a password for the root user
b) Delete Anonymous account
c) Remove the root user from remote login
d) Delete the test library and access to the test library
e) Refresh the authorization form for the changes to take effect
Mysql-u root-p Connection Database
Create DATABASE WordPress; Using commands to manipulate databases after connecting to a database
3. Install PHP
Yum install PHP php-mysql php-fpm installed PHP and must be connected to MySQL and Nginx extensions
Vi/etc/php.ini Configuring PHP:
Cgi.fix_pathinfo=0 the semicolon before this line is removed, change 1 to 0
vi/etc/php-fpm.d/www.conf Edit Server Connection configuration:
Listen =/var/run/php-fpm/php-fpm.sock changes the value of listen to this value
Listen.owner = Nobody the semicolon before this line is removed
Listen.group = Nobody the semicolon before this line is removed
user = Nginx
Group = Nginx Changes the value of these two rows from Apache to Nginx
Systemctl Start PHP-FPM
Systemctl Enable PHP-FPM
4. Configure Nginx to PHP
Vi/etc/nginx/conf.d/wordpress.conf
Server {Listen80; server_name tirion.me www.tirion.me; # Note that these lines is originally from the"Location/"Block Root/home/web/wordpress; # Configure the directory path for WordPressindex index.php index.html index.htm; Location/{try_files $uri $uri/=404; } error_page404/404.html; Error_page 502 503 504/50x.html; Location =/50x.html {root/usr/share/nginx/html; } Location~\.php$ {try_files $uri=404; Fastcgi_pass Unix:/var/run/php-fpm/php-Fpm.sock; Fastcgi_index index.php; Fastcgi_param script_filename $document _root$fastcgi_script_name; Include Fastcgi_params; }}
Systemctl Restart Nginx
5. Install FTP
Yum Install vsftpd FTP Service
Systemctl Start Vsftpd.service
Systemctl Enable Vsftpd.service
vi/etc/vsftpd/vsftpd.conf Modify the FTP configuration:
Anonymous_enable=no this line to No, anonymous logon is not allowed
Allow the root user to use FTP:
Remove or comment out the root in/etc/vsftpd/ftpusers
Remove or comment out the root in/etc/vsftpd/user_list
Configuration iptables:
Iptables-a input-p tcp-m State--state new-m TCP--dport 21-j ACCEPT
Systemctl Restart Vsftpd.service Restart FTP service
6. Install WordPress
1) Download the wordpress installation package from https://cn.wordpress.org/, unzip and upload to the server corresponding directory by FTP, this is/home/web/wordpress
2) chmod 777-r wordpress to wordpress permissions
3) URL access: http://tirion.me/wp-admin/install.php for automatic installation
4) Configure the user name, password, and database name of the MySQL connection as needed to install it
CentOS 7 Installation Wordpress,php,nginx,mysql (MariaDB)