sudo vi /etc/yum.repos.d/remi-enterprise.repo
以下の内容で保存します.
[remi]
name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
enabled=0
gpgcheck=1
gpgkey=http://rpms.famillecollet.com/RPM-GPG-KEY-remi
[remi-php55]
name=Les RPM de remi de PHP 5.5 pour Enterprise Linux $releasever - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/$releasever/php55/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/php55/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1
gpgkey=http://rpms.famillecollet.com/RPM-GPG-KEY-remi
sudo yum install --enablerepo=remi-php55 php php-fpm
sudo chkconfig php-fpm on
sudo vi /etc/php-fpm.d/www.conf
40行目付近の二箇所を apache
から nginx
に変更します.
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx
sudo vi /etc/php.ini
366行目付近の,expose_php
を Off
にします.
;;;;;;;;;;;;;;;;;
; Miscellaneous ;
;;;;;;;;;;;;;;;;;
; Decides whether PHP may expose the fact that it is installed on the server
; (e.g. by adding its signature to the Web server header). It is no security
; threat in any way, but it makes it possible to determine whether you use PHP
; on your server or not.
; http://www.php.net/manual/en/ini.core.php#ini.expose-php
expose_php = Off
sudo service php-fpm start
.php
ファイルへのアクセス時に,PHP-FPMを使うように設定します.
sudo vi /etc/nginx/conf.d/default.conf
以下の中身に変更し,保存します.
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
sudo nginx -t
sudo service nginx reload
phpinfo()
関数を実行するファイルを作成し動作確認を行います.
sudo vi /usr/share/nginx/html/phpinfo.php
以下の中身でファイルを作成し,保存します.
<?php
phpinfo();
ブラウザから http://IPアドレス/phpinfo.php
にアクセスします.