Record some pitfalls in the implementation of lnmp multi-host architecture WordPress blogs

Source: Internet
Author: User
Tags php website website server nginx host
** First introduce lnmp **
  • Lnmp is: nginx + MySQL + PhP website server architecture in Linux
  • Nginx is a high-performance HTTP and reverse proxy server and an IMAP/POP3/SMTP proxy server.
  • MySQL is a small relational database management system.
  • PHP is a script language for embedding HTML documents on the server.
  • Lnmp is a free, efficient, and scalable website service system.
** You can deploy the entire framework in the following ways **:
  1. Use the RPM package to install and deploy one host at a time;
  2. Install and deploy the source code one by one on the host;
  3. Use O & M tools (such as ansible) to install and deploy RPM packages on various hosts;
    Here I deploy it by compiling the source code.
** There is no doubt that extension deployment can improve service efficiency. Several machines work better together. **

Deployment process:

Install nginx on the nginx host, install PHP on the PHP host, and install MySQL on the Database Host. The compilation and installation process will not be detailed. The first step is to reach the first stage: problems on the PHP test page before the test is successful:

Everything went fine with nginx installation, but there was a problem with configuring PHP:
1. gracefully shutting down PHP-FPM. Done starting PHP-FPM [26-oct-2018 19: 35:
Modify configurations in php-fpm.conf
[Global]
; Note: the default prefix is
/Usr/local/PHP/var
Error_log = log/php_error_log
[Www]
Catch_workers_output = Yes

Modify PHP. ini
Log_errors = on
Error_log = "/usr/local/PHP/var/log/error_log"
Restart;

2. php warning: PhP startup: Unable to load dynamic library '/usr/local/PHP/lib/PHP/extensions/no-debug-non-ZTS
Open the php. ini file and check whether there is a line "extension =". If there is a line with this and there is no value, this error will be prompted. Just comment this line;
Another solution is to rename all the. ini files in the/etc/PHP. d/directory to. So;

3. nginx: [emerg] "server" Directive is not allowed here in/usr/local/nginx/CONF/nginx. conf: 45
This is because I wrote less than one} When configuring the nginx. conf file;

4. Test 502
This is annoying. Everything is ready. Open your browser with confidence and enter the web site result 502. You are not teasing me. From last night, there have been some solutions related to x×× 502, it was a pity that the problem had not been solved until noon today. Then there was a prompt that it was a firewall problem. I shut down the firewall, and it was amazing ???

5. nginx: [emerg] "location" directive is not allowed here in/etc/nginx/CONF. d/Default. conf: 1
As with the third configuration file ~

  1. Gracefully shutting down PHP-FPM warning, no PID file found-PHP-FPM is not running?
    Starting PHP-FPM error: Unable to bind listening socket for address '192. 168.92.128: 100': address already in use (98)


I searched the internet for a long time and did not solve the problem. Then I checked the logs and found that there was no route. I went to the firewall again.

No problem later. The initial wordpres is up.

The second stage is to build the WordPress environment on the nginx and PHP hosts. The source code is still compiled and installed, and the process is not detailed;

After configuring the Database Host, I encountered a lot of difficulties here. I first installed the MySQL 8 release version, but I wrote the configuration file according to the 5 style during configuration, the consequences can be imagined. The two most impressive records are as follows:

I wrote this:
Mysql> create user 'fuboyuanc' @ '%' identified by '123 ';
Mysql> grant all on WordPress. * To 'fuboyuanyuan '@' % 'with grant option;

It's okay ~ An error is returned ~
Later I learned that, when using mysql5, after installing MySql in Linux, I used to use grant all privileges on.To 'user' @ '%'; command to authorize remote connection operation. However, after MySQL 8 is installed in Linux recently, the following error occurs when you use this command again:

Error 1410 (42000): You are not allowed to create a user with Grant

It turns out to be using grant to modify account properties other than privilege assignments. This has des
Authentication, SSL, and resource-limit properties. Instead, establish such properties at account-Creation
Time With create user or modify them afterward with alter user.
This feature has been removed. The solution is to use alteruser and creatuser in the following format:
Alter user set user. Host = '%' where user. User = 'root'
Create user 'username' @ '%' identified...

Then you can remotely. Note: 'username' @ '%', % indicates that all remote addresses are allowed.
So 8 is written like this:
Mysql> alter user 'fuboyuanc' @ '%' identified with mysql_native_password by '123 ';

No problem ~

But !!!! I still cannot connect to the database with WordPress!
I'm crazy. I don't play 8 anymore. I opened 5 silently ,,,

The third stage is to configure WordPress. I used mysql5 to connect the database to Wordpress. The next step is the configuration process.

Result of configuration completion:

Although the building was successful, I still did not solve the problem of why WordPress cannot connect to mysql8. Baidu is useless. If you have any related solutions, please advise !!

Record some pitfalls in the implementation of lnmp multi-host architecture WordPress blogs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.