Question Summary
Nginx section
Essential Library
yum install -y wget vim gcc gcc-c++ zlib-devel pcre-devel openssl-devel
Compile Options
./configure --with-http_stub_status_module --prefix=/data/wwwroot/nginx-1.17.1 --user=www --group=www --with-http_ssl_module
Matters needing attention
To be added
start-up
.../sbin/nginx
Common Errors
To be added
Troubleshooting ideas
1. nginx-t, the simplest troubleshooting, checks the configuration file syntax of nginx, and returns a message similar to the following if no problem exists
nginx: the configuration file /data/wwwroot/nginx-1.17.1/conf/nginx.conf syntax is ok nginx: configuration file /data/wwwroot/nginx-1.17.1/conf/nginx.conf test is successful
2. Turn on logging for nginx
#error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info;
Just remove the previous'#'
MySQL section
Initialization parameters
bin/mysqld --initialize --user=www --basedir=/data/wwwroot/mysql --datadir=/data/wwwroot/mysql/data
Matters needing attention
The initialized password is saved in mysql_error.log under the log file (this file is the "log-error option" you defined in my.cnf file)
cat log/mysql_error.log | grep password
Modify MySQL password
bin/mysql_secure_installation
start-up
...support-files/mysql.server start # Official startup script
Common Errors
Question 1: When mysqld initialization is performed, 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 libaio runtime
yum install libaio libaio-devel -y
Question 2: When MySQL is started using the startup script that comes 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 my.cnf file
... [mysqld] user = www # Specify the running user of MySQL port = 3306 ...
PHP section
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
Compile 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 --with-openssl
Matters needing attention
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 -a etc/php-fpm.conf.default etc/php-fpm.conf cp -a 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
start-up
.../sbin/php-fpm
Common Errors
Question 1: Error occurred when starting php-fpm. 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 -a 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 it is sufficient to bring zlib when recompiling
Database Operation
Take MySQL database as an example
create database wordpress; grant all on wordpress.* to wordpress@'localhost' identified by '123456'; flush privileges;
Firewall Operations
Add 80 (http) and 443 (https) ports to open
firewall-cmd --zone=public --add-port=80/tcp --permanent Command Meaning: --zone #scope --add-port=80/tcp #Add Port in Port/Communication Protocol --permanent # is permanently valid and will not expire after restart without this parameter service iptables restart systemctl restart firewalld.service
Start-Up Self-Starting
Empowerment
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