Ubuntu14.04にnginxとPHP7をインストールメモ

1.nginxのインストール
#sudo apt-get install nginx

2.php7のダウンロード
http://php.net/downloads.php

php7のファイルをダウンロードして解凍する。

操作コマンド:
# cd php7***
# ./configure –prefix=/usr/local/php7 –with-config-file-path=/usr/local/php7/etc –with-mcrypt=/usr/include –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-gd –with-iconv –with-zlib –enable-xml –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –enable-mbregex –enable-fpm –enable-mbstring –enable-ftp –enable-gd-native-ttf –with-openssl –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear –with-gettext –enable-session –with-curl –with-jpeg-dir –with-freetype-dir –enable-opcache
# make
# make install

3.nginxの設定
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;
}

4.php-fpmの操作
# cp php.ini-production /usr/local/php7/etc/php.ini
# cp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpm
# chmod +x /etc/init.d/php7-fpm
# cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
# cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf

php-fpm起動
# service php7-fpm start

Nginx

Posted by arkgame