The most widely used blog system | wordpress deployment

Docker deploy wordpress

1. Pull wordpress mirror
docker pull wordpress: latest

  1. View Mirror
    docker images;

  2. Starting container docker run --name = wordpress -p 8003: 22 -p 8001: 80 -v / var / wordpress: / data wordpress
    • 8001 port to access the
    • The machine needs php environment
    • Wordpress installation data temporarily unclear in that place
    • Note that the path is a local database (host) instead of the current container or another container, then you need to fill the machine ip network, may not localhost or 127.0.0.1
    • Probably because nginx configuration results in a loss of style

Other issues: docker port mapping error Solution

docker: Error response from daemon: driver failed programming external connectivity。。。
  • Restart docker solve sudo systemctl restart docker

Style does not display properly

  • It is estimated that nginx configuration problem, this will not go into

End-use and typecho use the site as a way to configure

  • Install php environment, download the archive, extract to /var/www/htmlthis and as typecho do not say, should be noted that the directory directory permissions problem

  • Mysql installation configuration and NGINX

  • Related reference typechoconfiguration

Posted a configuration NGINX

server {
        listen          80;
        server_name     www.imisty.cn imisty.cn;
        root            /var/www/html/wordpress;
        index           index.html index.htm index.php;
        client_max_body_size 100M;

        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }

        location ~ .*\.php(\/.*)*$ {
            include fastcgi.conf;
            fastcgi_index  index.php;
            fastcgi_pass  127.0.0.1:9000;

            fastcgi_connect_timeout 300;

            fastcgi_send_timeout 300;

            fastcgi_read_timeout 300;
        }


        error_log  logs/error_wordpress.log;
        access_log logs/misty.log combined;
    }

Solutions to Common Problems

  • English packet into the Chinese environment, find wp-config.php in the root directory of the site, will be define('WPLANG', '');changed to define('WPLANG', 'zh_CN');not add to, and then refresh the console panel updates directly download the package appears to Chinese
  • Download the package needs to be verified ftp, edit wp-config.phpthe following to the official proposed changes come back after the upgrade is complete
define('WPLANG', 'zh_CN');
define("FS_METHOD", "direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);
  • Resolve "An error occurred while crop your image the" php-gd extension is not related to or installed it, you can search official forum

Open the domain names become home to download index.phpthe source code for the page, the page can be accessed by other paths or visit the domain name to jump to normal 127.0.0.1

This problem, a little ignorant, after all, is not how to change the configuration of NGINX, are properly before, but the configuration file change frequently due to the browser client does not parse php, home visit once found to solve this problem suspected browser cache caused the browser to remember the previous configuration will not parse html to php

Solution: This is because of the browser cache caused, you can clear your browser cache

Continuously refresh the page 502 error, php-cgi program crashes

Copy online solutions

  • Check whether the current number of PHP FastCGI process enough, if "the number of FastCGI process" closer to the actual use of the default "FastCGI number of processes," then explained "the number of FastCGI process" is not enough, need to increase

netstat -anpo | grep "php-cgi" | wc -l

  • Part of the PHP program execution time exceeds the waiting time Nginx may be appropriate to increase the timeout time nginx.conf FastCGI configuration file, for example:
http

{

......

fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

......
 
}
  • memory_limit in php.ini set low to be wrong, modify the php.ini memory_limit to 64M, restart nginx, we found good, turned out to be less than the PHP memory

Such repeatedly refresh still 502 errors

Nginx错误日志

recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 183.54.41.123, server: www.imisty.cn, request: "GET /index.php?rest_route=/yoast/v1/statistics HTTP/1.1", upstream: "fastcgi://127.0.0.1:8001", host: "imisty.cn", referrer: "http://imisty.cn/wp-admin/"

With php-fpmmanaged services to address the issue repeatedly refresh the page 502

  • yum install php70w-fpm Installation, because the old version previously installed, there is a conflict, you need to specify the version here
  • service php-fpm restart Start php-fpm Service

lsof view php-cgi kill off the port; php-fpm default port is 9000

The uploaded file exceeds the upload_max_filesize php.ini defined.

  • Modify the /etc/php.iniattribute value to the

Jetpack cause slow page card

It turns out that no matter how good things, inappropriate is inappropriate, to say the actual use of plug-ins did not much good, anyway card pages slow, seriously affect the speed and attitude

Under Linux php-fpm solving process leading to excessive memory exhaustion issue

Thanks to information provided by the junior partner
recently found open blog often can not connect the database and occur under normal circumstances network connection card slow problem; just thought it was before mining program due to loopholes in the invasion redis

But free -hafter viewing the CPU usage problem but found not to take up too much memory caused, on average each fpm process takes up 2%memory
View memory consumption up to 40 processps auxw|head -1;ps auxw|sort -rn -k4|head -40
img

The fourth column to view memory usage accounting, found that in addition mysql database services, php-fpm service pool opened too many sub-processes, taking up more than half the memory, to find the problem, we begin to solve the problem: Set the control php-fpm process pool number of processes

Solution:
through a variety of search tools, can be found by configuring pm.max_children property, control php-fpm number of child processes, first of all, open the php-fpm configuration file, execute instructions:

vi /etc/php-fpm.d/www.conf
Find the pm.max_childrenfield found that its value is too large:

pm.max_childrenValue of 50, each process occupies 1% -2.5% of memory, add up to spend more than half the memory, so we need to adjust small, bloggers here it is set to 25, at the same time, check the following two properties:

pm.max_spare_servers: This value represents the maximum number of processes to ensure free, if the idle process is greater than this value, this clean pm.min_spare_servers: to ensure that the minimum number of idle processes, if the idle process is less than this value, create new child process;

Both values can not exceed the pm.max_childrenvalue, normally set pm.max_spare_serversvalue of pm.max_children60% -80% of the value.

service php-fpm statusCheck the service status discovery configuration error
[pool www] pm.min_spare_servers(5) and pm.max_spar...en(25)at the beginning max_childrento 25, max_spare_serversto 35 found that service can not start

Finally, restart php-fpm

systemctl restart php-fpmOr service php-fpm restart
see again the memory usage, memory usage reduced a lot:
img

Other settings

ps: memory limit number to view the php-fpm open process and each process

  1. Total number of open command to view the server php-cgi process

ps -fe |grep "php-fpm"|grep "pool"|wc -l

  1. Check how many have php-cgi process for handling requests tcp
    netstat -anp|grep "php-fpm"|grep "tcp"|grep "pool"|wc -l
  2. linux+nginx+phpEnvironment, each process memory limit of php-fpm

Setting method:

Edit php-fpm.conf profile

php_admin_value[memory_limit] = 128M(I configuration file on the server in /etc/php5/fpm/pool.d/www.confthis file is included in the php-fpm.conf Lane) digital back can easily change: 32M, 64M, 128M, 256M , 512M, this setting according to your size and your server memory It needs to write, after modifying it to load php-fpm services.

Small indeed fortunate

每一丝灵感都值得被记录,每一笔记录都是成长,每一点成长都值得欢呼

Personal bloggers station: www.imisty.cn
CSDN blog: https://blog.csdn.net/lookinthefog
blog Park: https://imist.cnblogs.com/

Hope to know some tech-savvy small partner, welcome to the Friends link yo

Guess you like

Origin www.cnblogs.com/imist/p/11417562.html