Lnmp+wordpress environment building
Question summary Nginx part of the mandatory library yum install-y wget vim gcc gcc-c++ zlib-devel pcre-devel openssl-devel compilation options. / configure-- with-http_stub_status_module-- prefix=/data/wwwroot/nginx-1.17.1-- user=www-- group=www-- with-http_ssl_module considerations
To be replenished
Common errors in starting... / sbin/nginx
To be replenished
Eliminate the wrong train of thought
1. Nginx-t, the simplest way to debug, check the configuration file syntax of nginx, and if there is no problem, return a message similar to the following
Nginx: the configuration file / data/wwwroot/nginx-1.17.1/conf/nginx.conf syntax is oknginx: configuration file / data/wwwroot/nginx-1.17.1/conf/nginx.conf test is successful
2. Turn on the log function of nginx
# error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info
Just remove the previous "#".
MySQL partial initialization parameter bin/mysqld-- initialize-- user=www-- basedir=/data/wwwroot/mysql-- datadir=/data/wwwroot/mysql/data considerations
The initialized password is saved in mysql_error.log under the log file (this file is the "log-error option" you defined in the my.cnf file)
Cat log/mysql_error.log | grep password
Modify MySQL password
Bin/mysql_secure_installation startup... support-files/mysql.server start # common errors in official startup scripts
Problem 1: when performing the mysqld initialization operation, the error message is as follows:
Bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
Solution: install the libaio runtime
Yum install libaio libaio-devel-y
Problem 2: when starting MySQL using the startup script included with MySQL, the error message is as follows:
Starting MySQL. ERROR! The server quit without updating PID file (/ data/wwwroot/mysql/data/blog.blacklinux.cn.pid).
Solution: check permissions
1. MySQL path permissions
Chown-R www.www / data/wwwroot/mysql # here is your MySQL directory
2. Check the my.cnf file
[mysqld] user=www # specifies the user port for running MySQL = 3306...PHP part of the essential library yum install-y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel compilation parameters. / configure-- prefix=/data/wwwroot/php-7.3.7-- enable-mysqlnd-- with-mysqli=mysqlnd-- with-pdo-mysql=mysqlnd-- enable-fpm-- with-fpm-user=www- -with-fpm-group=www-- with-zlib-- considerations for with-openssl
Use the configuration file that comes with the PHP source package
Mv lib/php.ini-production lib/php.ini
Copy the default ungenerated configuration file for PHP
Cp-an etc/php-fpm.conf.default etc/php-fpm.confcp-an etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
Modify the mysqli.default_socket option in php.ini
Mysqli.default_socket = / data/wwwroot/mysql/run/mysql.sock startup. / sbin/php-fpm common errors
Problem 1: start php-fpm to report an error, and the error message is as follows:
[root@localhost php-7.3.7] # sbin/php-fpm [05-Jul-2019 04:01:01] WARNING: Nothing matches the include pattern'/ lnmp/php-7.3.7/etc/php-fpm.d/*.conf' from / lnmp/php-7.3.7/etc/php-fpm.conf at line 143.[ 05-Jul-2019 04:01:01] ERROR: No pool defined. At least one pool section must be specified in config file [05-Jul-2019 04:01:01] ERROR: failed to post process the configuration [05-Jul-2019 04:01:01] ERROR: FPM initialization failed
Solution: generate www.conf
Cp-an etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
Question 2: Fatal error: Uncaught Error: Call to undefined function gzinflate ()
Solution: this is because the source code compiles php without zlib, so you can recompile with zlib.
Database operation
Take MySQL database as an example
Create database wordpress;grant all on wordpress.* to wordpress@'localhost' identified by '123456 firewall operation with flush privileges;
Add ports 80 (http) and 443 (https) to open to the public
Firewall-cmd-- zone=public-- add-port=80/tcp-- permanent command meaning:-- zone # scope-- add-port=80/tcp # add port, format: Port / communication protocol-- permanent # is in permanent effect. Without this parameter, the firewall is rebooted when it fails to boot. Systemctl restart firewalld.service starts automatically.
Empowering
Chmod + x / etc/rc.d/rc.local
Add the following to rc.local
/ lnmp/nginx/sbin/nginx/lnmp/mysql/support-files/mysql.server start/lnmp/php/sbin/php-fpm