php related settings (thinkphp)


Ref: http://yenpai.idis.com.tw/archives/360-%E6%95%99%E5%AD%B8-%E5%9C%A8-centos-%E4%B8%AD%E5%AE%89%E8%A3%9D-php-fpm-for-nginx

php5.6 fpm config:
/etc/php/5.6/fpm/pool.d/www.conf


listen = 127.0.0.1:9999
listen.allowed_clients = 127.0.0.1
 
user = www-data
group = www-data
 
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
 
slowlog = /var/log/php-fpm/www-slow.log
 
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on


改完之後要重啟php5.6-fpm
/etc/init.d/php5.6-fpm restart
service php5.6-fpm restart

php5.6-fpm的log
/var/log/php5.6-fpm.log

當php5.6-fpm stop 跑出 unknown instance時
可以透過以下來找出開啟的php5.6-fpm process

ps aux | grep php
然後把找到的pid給kill掉

nginx config

server {
        listen 80;
        server_name cari-test.com;
        root /home/neil/cari_test/public;
        index       index.php index.html;

        location / {
                if (!-e $request_filename) {
                        rewrite ^/(.*)$ /index.php?s=$1;
                }
        }
        location ~* \/upload\/.+\.(html|php)$ {
                return 404;
        }
        location ~* ^\/plugins\/.+\.(html|php)$ {
                return 404;
        }
        location ~* \/themes\/.+\.(html|php)$ {
                return 404;
        }
        location ~ \.php {
                include fastcgi_params;
                set $path_info "";
                set $real_script_name $fastcgi_script_name;
                if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                        set $real_script_name $1;
                        set $path_info $2;
                }
                fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
                fastcgi_param SCRIPT_NAME $real_script_name;
                fastcgi_param PATH_INFO $path_info;
                fastcgi_intercept_errors on;
                fastcgi_pass   127.0.0.1:9999;
        }
}


之後必須重啟nginx
service nginx restart




留言

這個網誌中的熱門文章

[翻譯] 介紹現代網路負載平衡與代理伺服器

Grafana K6

Linux 事件驅動筆記