安裝LENP環境 2018-06-16版本 2018-06-18
1. 啟用EPEL
sudo yum install epel-release
sudo yum update
2. 安裝Nginx
sudo yum install nginx
sudo systemctl enable nginx
sudo systemctl start nginx
3. 安裝MariaDB ( /etc/yum.repos.d/MariaDB.repo )
# MariaDB 10.2 CentOS repository list - created 2018-06-16 09:31 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
sudo yum install MariaDB-server MariaDB-client
4. 安裝PHP72
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum --enablerepo=remi-php72 install php
php -v
PHP 7.2.0 (cli) (built: Nov 28 2017 20:22:21) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
5. 安裝PHP72模組(包含PHP fpm)
yum --enablerepo=remi,remi-php72 install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
yum --enablerepo=remi,remi-php72 install nginx php-fpm php-common
php -modules
6. 設定nginx環境並重啟nginx/php-fpm
sudo systemctl restart nginx
sudo systemctl restart php-fpm
7. 解決SELinux造成/var/www/html權限問題(13: Permission Denied)
https://stackoverflow.com/questions/22586166/why-does-nginx-return-a-403-even-though-all-permissions-are-set-properly/26228135
(看這篇)https://www.serverlab.ca/tutorials/linux/web-servers-linux/configuring-selinux-policies-for-apache-web-servers/
getenforce
setenforce Permissive (重啟Server)
chcon -Rt httpd_sys_rw_content_t /var/www/html
setsebool -P httpd_can_network_connect on