This is the ninth day of my participation in the First Challenge 2022. For details: First Challenge 2022.


  • 🤟 blogger introduction: CSDN, Toutiao, Zhihu and other platforms quality bloggers, the whole network fans 2W +
  • 💬 If the article is helpful to you, welcome to follow, like, bookmark (click three links) and subscribe

In the last article, we completed the basic WordPress environment construction, but it is far from enough to build a distinctive website, because there are some default Settings for WordPress itself and its dependent environment. In order to better use WordPress, we need to solve these problems. The following is a summary of a series of problems encountered using WordPress backend.


1. WordPress can only upload files smaller than 2M by default

Cause: It is true that this is not a limitation in WordPress software, it is actually a limitation in the PHP default configuration file, so we need to change the maximum upload size in PHP.

Solution:

1, find the PHP configuration file PHP ini, the command is as follows: PHP – I | grep ‘the php.ini’

Upload_max_filesize, post_max_size, upload_max_filesize, post_max_size, upload_max_filesize, post_max_size, upload_max_filesize, post_max_size, upload_max_filesize, post_max_size, upload_max_filesize

  • Upload_max_filesize: specifies the maximum upload size
  • Post_max_size: indicates the maximum size of a POST request
  • Memory_limit: The memory limit that a PHP process can use
  • Max_execution_time: the maximum execution time of a PHP program
  • Max_input_time: indicates the maximum input time

3. Run the following command to restart the PHP server:./php-fpm restart

4, re-enter the blog system background, refresh again to see whether it takes effect


2. Pictures or media files larger than 2M cannot be uploaded

Description: An unexpected response was received from the server. This file may have been successfully uploaded or image post-processing failed. Maybe the server is busy or does not have enough resources.

Why: Since PHP restrictions have been changed, what else could be the reason? Nginx also has a limit (by default, the maximum upload size is 1 MB). We need to modify nginx.conf to resize client_max_body_size 128m;

Solution:

1. Find the nginx configuration file

2. Add client_max_body_size property

3. Go to the sbin directory and reload the nginx configuration./nginx -s reload

4, enter the blog background, try to upload again


3. Uploading files fails, indicating that directory XXX cannot be created

Wp-content /uploads/ XXX cannot be created. Can its parent directory be written to by the server?

Cause: The wp-content directory does not have write permission

Solution:

1. Go to the wp-content directory in wordpress and use chmod to grant write permission to the wp-content directory

2. Go back to the blog background and upload the file again successfully


4. After modifying the WordPress address and site address, the system will visit 404

By default, the address of the blog background and the address of the blog foreground are the same. Many partners in order to distinguish the address of the background system (i.e. WordPress address) and the address of the blog visit (i.e. site address), after initialization will modify them, but after modification found that all pages can not appear 404.

Solution:

1, find the nginx configuration file and add the following code to server{} :

try_files $uri $uri/ /index.php? $args; rewrite /wp-admin$ $scheme://$host$uri/ permanent;Copy the code

2. Reload the nginx configuration file and try again


Five, modify fixed link rules (pseudo static) after the blog article 404

Problem Description: Changing the default Url structure of WordPress helps us to improve the beauty, usability, and forward compatibility of links to the website, but after changing this structure, we find that all the articles appear 404.

Related concepts: pseudo-static is relative to real static, usually in order to enhance the friendly side of the search engine, the content of the article will generate static pages

Solution: Set nginx’s pseudo-static rules

Try_files uriuri uriuri/ /index.php? $args;

2. Reload the nginx configuration file and try again


Please enter your FTP account and password when you install the theme

Symptom: When you install the WordPress theme online, enter the FTP account password or fail to create a directory

Possible cause: The access permission for the wordpress folder is insufficient

Solution:

1. Change the access permission of the wordpress folder to readable, writable and executable, run the chmod -r 777 /wordpress command

Wp-config. PHP: define(‘FS_METHOD’,’direct’);

3. Go back to the blog background and reinstall it successfully


Write in the last

The common problems encountered in building a personal website with WordPress are basically summarized above. After solving these problems, we can formally start the construction of personal characteristics blog. The next article will focus on how to use themes and tools to make your site more cool. The topics are chosen by bloggers over a few days, which is more efficient than searching for them all online.

If you find the article helpful, please like, bookmark and follow the blogger. The following bloggers will bring more quality and quality articles.

To learn more and learn more about open source projects, please click below to add a blogger and enter the technical circle (all resources in the circle are free, but you are required to have a long-term interest in joining, if it is just an impulse, it is not recommended to join, after all, the quota is limited).


series

Nginx installation tutorial 4, 10 minutes to build cool personal website