sudo apt-get install php-fpm
安装成功后,会自动运行php-fpm,php-fpm默认使用的unix socket,修改配置文件,配置文件路径在/etc/php/7.0/fpm/pool.d/www.conf
启动php-fpm
sudo php-fpm7.2
nginx配置
server {
listen 80;
server_name wx.iyucc.com;
location / {
root /www/wxtaobaoke/;
index index.php index.html ;
}
location ~ \.php$ {
root /www/wxtaobaoke/; # 要解析的index.php所在的目录
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~(wechat|user) {
proxy_pass http://127.0.0.1:3008;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
遇到问题
ubuntu php安装curl扩展
apt-cache search curl | grep php
sudo apt-get install php7.2-curl
mbstring 未开启,请先开启mbstring扩展,否则无法运行
sudo apachectl restart
重启nginx
sudo /usr/local/nginx/sbin/nginx -s reload
cache 无效,请先设置目录读写权限,请联系您的空间或者服务器提供商
cd /var/www/html/
mkdir cache
chmod 777 cache