PHP, Nginx, Fedora 22

php-fpm 和 nginx 的配置非常容易:

dnf install php php-fpm php-mysql php-gd php-mcrypt php-mbstring

vim /etc/php-fpm.d/www.conf

把里面的 apache 改为 nginx

; RPM: apache Choosed to be able to access some dir as httpd 
user = apache 
; RPM: Keep a group allowed to write in log dir. 
group = apache 


systemctl restart php-fpm

注意你的 php-fpm socket 现在也是在 /etc/php-fpm.d/www.conf 里面配置的,在 nginx 里可以使用:

fastcgi_pass unix:/run/php-fpm/www.sock;


location ~ \.php$ {
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/run/php-fpm/www.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;