nginx相关
<h2>nginx</h2>
<h2>php-fpm 相关</h2>
<ol>
<li>
<p>安装</p>
<p><code>yum install php-fpm</code></p>
</li>
<li>
<p>更改 php-fpm 配置</p>
<p>修改运行身份,保障对目录有可读权限,否则会报 404 错误:</p>
<pre><code>user = www-data
group = www-data</code></pre>
<p>如果 www-data 用户不存在,那么先添加 www-data 用户:</p>
<pre><code>groupadd www-data
useradd -g www-data www-data</code></pre>
<blockquote>
<p>一般配置在 /etc/php-fpm.d/ 下面</p>
</blockquote>
</li>
<li>
<p>修改 nginx 配置,部分如下:</p>
<pre><code># pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}</code></pre>
</li>
<li>
<p>创建测试 php 文件</p>
<p>在 www 目录创建 index.php</p>
<pre><code><?php
echo phpinfo();
?></code></pre>
</li>
<li>
<p>启动 php-fpm</p>
<p><code>php-fpm -D</code></p>
</li>
</ol>
<blockquote>
<p>参考文档:<a href="https://wizardforcel.gitbooks.io/nginx-doc/content/Text/6.5_nginx_php_fpm.html">https://wizardforcel.gitbooks.io/nginx-doc/content/Text/6.5_nginx_php_fpm.html</a></p>
</blockquote>