環境:
$ useradd -u 1201 -s /sbin/nologin -d /dev/null blog1
CREATE DATABASE dbblog1;CREATE USER 'blog1'@'localhost' IDENTIFIED BY '<password>';GRANT ALL ON dbblog1.* TO 'blog1'@'localhost';FLUSH PRIVILEGE;
$ tar zxvf wordpress-4.4.2-zh_CN.tar.gz$ mv wordpress blog1$ chown -R blog1 blog1$ ls -alhd blog1drwxr-xr-x 5 blog1 nogroup 4.0K Feb 3 08:13 blog1
; Include one or more files. If glob(3) exists, it is used to include a bunch of; files from a glob(3) pattern. This directive can be used everywhere in the; file.; Relative path can also be used. They will be prefixed by:; - the global prefix if it's been set (-p argument); - /usr/lib64/php5.6 otherwiseinclude=/etc/php/fpm-php5.6/etc/fpm.d/*.conf
$ cat /etc/php/fpm-php5.6/etc/fpm.d/blog1.conf[blog1]user = blog1 ; php-fpm子进程的uidgroup = nogrouplisten = /var/run/php-fpm-blog1.socklisten.owner = nginx ; sock通信文件的属主, 和nginx通信listen.group = nginx ; sock通信文件的属组, 和nginx通信listen.mode = 0660pm = dynamicpm.max_children = 5pm.start_servers = 2pm.min_spare_servers = 1pm.max_spare_servers = 3chroot = /var/www/blog1chdir = /
$ ps aux | grep phproot 5646 0.0 0.3 247836 7192 ? Ss 14:55 0:00 php-fpm: master process (/etc/php/fpm-php5.6/php-fpm.conf)blog1 5647 0.0 0.6 247944 13884 ? S 14:55 0:00 php-fpm: pool blog1blog1 5648 0.0 0.6 247812 13192 ? S 14:55 0:00 php-fpm: pool blog1blog2 5649 0.0 1.4 251840 29756 ? S 14:55 0:00 php-fpm: pool blog2blog2 5650 0.0 0.3 247812 6636 ? S 14:55 0:00 php-fpm: pool blog2root 10071 0.0 0.1 112700 2100 pts/4 S+ 15:52 0:00 grep --color php$ pwdx 56475647: /var/www/blog1
server { listen 80; server_name blog1.tankywoo.com; index index.php; access_log /var/log/nginx/blog1_log main; error_log /var/log/nginx/blog1_error_log; root /var/www/blog1/; location ~ .php$ { try_files $uri =404; fastcgi_pass unix:///var/run/php-fpm-blog1.sock; include fastcgi.conf; fastcgi_param SCRIPT_FILENAME /$fastcgi_script_name; }}
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
$ mkdir -p /var/www/blog1/var/run/mysqld$ mount --bind /var/run/mysqld /var/www/blog1/var/run/mysqld