[www] listen = /tmp/www.sock listen.mode=666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024
[aming] listen = /tmp/aming.sock listen.mode=666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024
[root@hanfeng ~]# ps aux |grep php-fpm root 2280 0.0 0.4 227776 4952 ? Ss 18:29 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf) php-fpm 2281 0.0 0.4 227776 4708 ? S 18:29 0:00 php-fpm: pool www php-fpm 2282 0.0 0.4 227776 4708 ? S 18:29 0:00 php-fpm: pool www php-fpm 2283 0.0 0.4 227776 4708 ? S 18:29 0:00 php-fpm: pool www php-fpm 2284 0.0 0.4 227776 4708 ? S 18:29 0:00 php-fpm: pool www php-fpm 2285 0.0 0.4 227776 4712 ? S 18:29 0:00 php-fpm: pool www php-fpm 2286 0.0 0.4 227776 4712 ? S 18:29 0:00 php-fpm: pool www php-fpm 2287 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2288 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2289 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2290 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2291 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2292 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2293 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2294 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2295 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2296 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2297 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2298 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2299 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www php-fpm 2300 0.0 0.4 227776 4716 ? S 18:29 0:00 php-fpm: pool www root 7644 0.0 0.0 112680 984 pts/0 S+ 21:38 0:00 grep --color=auto php-fpm [root@hanfeng ~]#
[root@hanfeng ~]# cd /usr/local/php-fpm/etc/ [root@hanfeng etc]# ls pear.conf php-fpm.conf php-fpm.conf.default php.ini [root@hanfeng etc]# cat php-fpm.conf [global] pid = /usr/local/php-fpm/var/run/php-fpm.pid error_log = /usr/local/php-fpm/var/log/php-fpm.log [www] listen = /tmp/php-fcgi.sock listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 [root@hanfeng etc]#
[root@hanfeng etc]# vi /usr/local/php-fpm/etc/php-fpm.conf [global] pid = /usr/local/php-fpm/var/run/php-fpm.pid error_log = /usr/local/php-fpm/var/log/php-fpm.log [www] listen = /tmp/php-fcgi.sock listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 [hanfeng.com] listen = /tmp/hanfeng.sock listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 保存退出
[root@hanfeng etc]# /usr/local/php-fpm/sbin/php-fpm -t [09-Jan-2018 23:28:58] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful [root@hanfeng etc]#
[root@hanfeng etc]# /etc/init.d/php-fpm reload Reload service php-fpm done [root@hanfeng etc]#
[root@hanfeng etc]# ps aux |grep php-fpm root 7731 0.0 0.4 227836 4964 ? Ss 22:32 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf) php-fpm 7732 0.0 0.4 227776 4708 ? S 22:32 0:00 php-fpm: pool www php-fpm 7733 0.0 0.4 227776 4708 ? S 22:32 0:00 php-fpm: pool www php-fpm 7734 0.0 0.4 227776 4708 ? S 22:32 0:00 php-fpm: pool www php-fpm 7735 0.0 0.4 227776 4708 ? S 22:32 0:00 php-fpm: pool www php-fpm 7736 0.0 0.4 227776 4712 ? S 22:32 0:00 php-fpm: pool www php-fpm 7737 0.0 0.4 227776 4712 ? S 22:32 0:00 php-fpm: pool www php-fpm 7738 0.0 0.4 227776 4712 ? S 22:32 0:00 php-fpm: pool www php-fpm 7739 0.0 0.4 227776 4712 ? S 22:32 0:00 php-fpm: pool www php-fpm 7740 0.0 0.4 227776 4712 ? S 22:32 0:00 php-fpm: pool www php-fpm 7741 0.0 0.4 227776 4712 ? S 22:32 0:00 php-fpm: pool www php-fpm 7742 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool www php-fpm 7743 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool www php-fpm 7744 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool www php-fpm 7745 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool www php-fpm 7746 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool www php-fpm 7747 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool www php-fpm 7748 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool www php-fpm 7749 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool www php-fpm 7750 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool www php-fpm 7751 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool www php-fpm 7752 0.0 0.4 227776 4712 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7753 0.0 0.4 227776 4712 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7754 0.0 0.4 227776 4712 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7755 0.0 0.4 227776 4712 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7756 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7757 0.0 0.4 227776 4716 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7758 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7759 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7760 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7761 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7762 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7763 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7764 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7765 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7766 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7767 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7768 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7769 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7770 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com php-fpm 7771 0.0 0.4 227776 4720 ? S 22:32 0:00 php-fpm: pool hanfeng.com root 7775 0.0 0.0 112676 988 pts/0 R+ 22:39 0:00 grep --color=auto php-fpm [root@hanfeng etc]#
[root@hanfeng etc]# cd /usr/local/nginx/conf/vhost/ [root@hanfeng vhost]# ls aaa.com.conf load.conf proxy.conf ssl.conf test.com.conf [root@hanfeng vhost]#
[root@hanfeng vhost]# vim test.com.conf server { listen 80; server_name test.com test1.com test2.com; index index.html index.htm index.php; root /data/wwwroot/test.com; if ($host != 'test.com' ) { rewrite ^/(.*)$ http://test.com/$1 permanent; } # location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ # { # expires 7d; # access_log off; #} location ~* ^.+.(gif|jpg|png|swf|flv|rar|zip|doc|pdf|gz|bz2|jpeg|bmp|xls)$ { expires 7d; valid_referers none blocked server_names *.test.com ; if ($invalid_referer) { return 403; } access_log off; } location ~ .*\.(js|css)$ { expires 12h; access_log off; } location /admin/ { allow 192.168.202.130; allow 127.0.0.1; deny all; } location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/tmp/php-fcgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data/wwwroot/test.com$fastcgi_script_name; } access_log /tmp/test.com.log combined_realip; }
[root@hanfeng vhost]# vim aaa.com.conf server { listen 80 default_server; server_name aaa.com; index index.html index.htm index.php; root /data/wwwroot/default; } location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/tmp/hanfeng.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data/wwwroot/default$fastcgi_script_name; } 保存退出
[root@hanfeng vhost]# ls aaa.com.conf load.conf proxy.conf ssl.conf test.com.conf [root@hanfeng vhost]# tail ../nginx.conf tcp_nodelay on; gzip on; gzip_min_length 1k; gzip_buffers 4 8k; gzip_comp_level 5; gzip_http_version 1.1; gzip_types text/plain application/x-javascript text/css text/htm application/xml; include vhost/*.conf; } [root@hanfeng vhost]#
[root@hanfeng etc]# cat php-fpm.conf [global] pid = /usr/local/php-fpm/var/run/php-fpm.pid error_log = /usr/local/php-fpm/var/log/php-fpm.log [www] listen = /tmp/php-fcgi.sock listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 [hanfeng.com] listen = /tmp/hanfeng.sock listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 [root@hanfeng etc]#
最終以下javascript
[root@hanfeng etc]# vim php-fpm.conf [global] pid = /usr/local/php-fpm/var/run/php-fpm.pid error_log = /usr/local/php-fpm/var/log/php-fpm.log include = etc/php-fpm.d/*.conf
[root@hanfeng etc]# mkdir php-fpm.d [root@hanfeng etc]#
[root@hanfeng etc]# cd !$ cd php-fpm.d [root@hanfeng php-fpm.d]# vim www.conf [www] listen = /tmp/php-fcgi.sock listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 保存退出
[root@hanfeng php-fpm.d]# vim hanfeng.conf [hanfeng.com] listen = /tmp/hanfeng.sock listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 保存退出
[root@hanfeng php-fpm.d]# /usr/local/php-fpm/sbin/php-fpm -t [09-Jan-2018 23:28:58] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful [root@hanfeng php-fpm.d]#
[root@hanfeng php-fpm.d]# /etc/init.d/php-fpm restart Gracefully shutting down php-fpm . done Starting php-fpm done [root@hanfeng php-fpm.d]# !ps ps aux |grep php-fpm root 7832 0.2 0.4 227864 4980 ? Ss 23:29 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf) php-fpm 7833 0.0 0.4 227804 4712 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7834 0.0 0.4 227804 4712 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7835 0.0 0.4 227804 4712 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7836 0.0 0.4 227804 4712 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7837 0.0 0.4 227804 4716 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7838 0.0 0.4 227804 4716 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7839 0.0 0.4 227804 4716 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7840 0.0 0.4 227804 4716 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7841 0.0 0.4 227804 4716 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7842 0.0 0.4 227804 4716 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7843 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7844 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7845 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7846 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7847 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7848 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7849 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7850 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7851 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7852 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool hanfeng.com php-fpm 7853 0.0 0.4 227804 4716 ? S 23:29 0:00 php-fpm: pool www php-fpm 7854 0.0 0.4 227804 4716 ? S 23:29 0:00 php-fpm: pool www php-fpm 7855 0.0 0.4 227804 4716 ? S 23:29 0:00 php-fpm: pool www php-fpm 7856 0.0 0.4 227804 4716 ? S 23:29 0:00 php-fpm: pool www php-fpm 7857 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool www php-fpm 7858 0.0 0.4 227804 4720 ? S 23:29 0:00 php-fpm: pool www php-fpm 7859 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7860 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7861 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7862 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7863 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7864 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7865 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7866 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7867 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7868 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7869 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7870 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7871 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www php-fpm 7872 0.0 0.4 227804 4724 ? S 23:29 0:00 php-fpm: pool www root 7874 0.0 0.0 112676 988 pts/0 R+ 23:29 0:00 grep --color=auto php-fpm [root@hanfeng php-fpm.d]#