-
安裝 Remi 套件的 repo 檔案:
#wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
#rpm -Uvh remi-release-7.rpm
-
安裝 PHP 7.0 套件:
# yum install php70 php70-php-fpm php70-php-mbstring php70-php-mcrypt php70-php-gd
-
修改 php-fpm 設定檔:
#vim /etc/opt/remi/php70/php-fpm.d/www.conf
user = nginx
group = nginx
listen = /var/run/php-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0666
-
啟動 php-fpm 服務:
# systemctl enable php70-php-fpm.service
# systemctl start php70-php-fpm.service
-
修改 Nginx 設定檔:
# vim /etc/nginx/conf.d/default.conf
(修改下列設定:)
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log warn;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /usr/share/nginx/html;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
:
:
-
動新啟動 nginx:
#systemctl restart nginx.service
-
開啟 SELinux 設定:
#setsebool -P httpd_can_network_connect on