当配置nginx的nginx.conf 时,可参照如下配置:

server {
  listen 80;
  server_name www.advancephp2017.com;
  access_log logs/advance.access.log;

  root /home/andrewghost/www/advancephp;
  location / {
    index index.html index.php;
  }
  location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}

在nginx.conf配置user(默认nobody),我在这里设为user andrewghost,注意,php7版本下需要对/usr/local/php/etc/php-fpm.d里面对www.conf作一点修改:

user = andrewghost #和nginx.conf里的user对应,默认nobody

group = team #你自己的组,默认nobody

否则,只修改nginx,php文件访问的时候会报file not founds