centos7上安装LNMP环境

centos7上安装LNMP环境_第1张图片
7e1e8bd7a80b378312ae9692e2a432e8.png

以下操作均在root用户下完成。

配置系统的文字系统

vi /etc/environment

LC_ALL=en_US.utf-8
LANG=en_US.utf-8

配置基础用户

useradd -m deploy

useradd  www
usermod -a -G deploy www

安装php

yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-devel php56w-fpm

参考:

  • https://webtatic.com/packages/php56/

安装redis

yum install redis

安装php的redis扩展

git clone git://github.com/nicolasff/phpredis.git
cd phpredis
phpize
./configure
make
sudo -s make install

sudo -s
echo "extension=redis.so">/etc/php5/conf.d/redis.ini
exit

参考:

  • http://stackoverflow.com/questions/25230399/fatal-error-class-redis-not-found

检测是否有安装:

php -m | grep redis

安装nginx

yum install nginx

安装mysql

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update

sudo yum install mysql-server
sudo systemctl start mysqld

然后,secure mysql

mysql_secure_installation

安装composer

yum install composer
composer global require "fxp/composer-asset-plugin:~1.2.0"

配置redis

调整daemon状态

配置php-fpm

调整运行用户,deploy

配置nginx

调整运行用户,deploy

optional

配置iptables

  • https://www.digitalocean.com/community/tutorials/how-to-set-up-a-basic-iptables-firewall-on-centos-6

你可能感兴趣的:(centos7上安装LNMP环境)