[今日记录] PHP安装 & wordpress部署, Nginx 1.7.3, Ubuntu 12.04

版本:

PHP 5.5.15

环境:

操作系统:Ubuntu 12.04 LTS

服务器:Nginx 1.7.3

参考资料:

http://php.net/manual/zh/install.unix.nginx.php

下载:

http://cn2.php.net/downloads.php

tar xvfz .tar.gz && cd     tar.gz 解压    (tar.bz2 如何解压?)

步骤记录备份:

安装(必须设允许fpm,此处使用数据库为MySQL):

./configure --enable-fpm --with-mysql
sudo make
sudo make install

配置:

sudo cp php.ini-development /usr/local/php/php.ini
sudo cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
sudo cp sapi/fpm/php-fpm /usr/local/bin

修改php.ini:

cgi.fix_pathinfo=0

修改php-fpm.conf:

user = www-data
group = www-data

修改nginx.conf(默认安装于 /usr/local/nginx/conf/nginx.conf):

location / {
    root   html;
    index  index.php index.html index.htm;
}

location ~* \.php$ {
    fastcgi_index   index.php;
    fastcgi_pass    127.0.0.1:9000;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
}

运行:

启动php-fpm:

/usr/local/bin/php-fpm

重载Nginx配置文件:

sudo nginx -s reload

至此,PHP安装完毕。

到wordpress.org下载最新wordpress安装包,解压到nginx的网站目录下,再浏览器登录安装。安装前需配置好MySQL数据库。

create database wordpress
create user "wpuser"@"localhost" identified by "123456"
grant create,delete,update,insert,drop,select on wordpress.* to wpuser@localhost identified by "123456"

安装完后wordpress 的主页登录很慢,因为其wp-includes/script-loader.php 里的字体设定到 fonts.googleapis.com 去找。360提供了国内镜像源。

将fonts.googleapis.com替换为 fonts.useso.com 即可。若使用emacs: 

M-X replace-string \n fonts.googleapis.com \n fonts.useso.com




你可能感兴趣的:(工作笔记,php,ubuntu,nginx)