Description
Operating system: CENTOS7;
PHP installation directory:/USR/LOCAL/PHP7;
PHP.ini configuration file path:/usr/local/php7/etc/php.ini;
PHP.ini configuration file path:/usr/local/php7/etc/php.ini;
Nginx installation directory:/usr/local/nginx;
Nginx site root directory:/data/www;
1, install the compilation tool:
Yum-y Install kernel keyutils patch perl tcl
2, installation Redis:
①, download Redis and compile Redis:
CD ~ && wget http://download.redis.io/redis-stable.tar.gz
tar-zxvf redis-stable.tar.gz
CD Redis-stable make
Generally speaking, as long as I have to install the LNMP environment down to make will not be a problem, made to do after making test, in the SRC directory after the OK, you will have some more executable files: Redis-server, Redis-cli and so on. ②, modify, edit Redis configuration file and other auxiliary profiles: 1, modify other configuration files, the following changes to the contents of the operation reason can consult the relevant information:
echo "Vm.overcommit_memory=1" >>/etc/sysctl.conf
echo "net.core.somaxconn = 551" >>/etc/sysctl.conf< C1/>echo "* Soft nofile 10032" >>/etc/security/limits.conf
echo "* hard, Nofile 10032" >>/etc/security/li Mits.conf
echo "if Test-f/sys/kernel/mm/transparent_hugepage/enabled; Then
echo never >/sys/kernel/mm/transparent_hugepage/enabled
fi
if Test-f/sys/kernel/mm/ Transparent_hugepage/defrag; Then
echo never >/sys/kernel/mm/transparent_hugepage/defrag
fi >>/etc/rc.local
The above content has been modified, in order to make the modified content effective, please reboot the machine, after the reboot, do the following: 2, create Redis configuration file:
CD ~/REDIS-STABLE/SRC
CP redis-server/usr/local/bin/
CP redis-cli/usr/local/bin/
Then create a new directory to store the configuration file:
Mkdir-p/etc/redis
mkdir-p/var/redis/log
mkdir-p/var/redis/run mkdir-p/var/redis/6379
Locate the profile template in the Redis solution directory and copy it to the Redis configuration folder:
Cd.. /
CP redis.conf/etc/redis/6379.conf
Modify 6379.conf:
Vi/etc/redis/6379.conf
Change Daemonize No to daemonize Yes to ensure Redis can run in the background;
Change the pidfile/var/run/redis.pid to Pidfile/var/redis/run/redis.pid;
Change the logfile "" to logfile "/var/redis/log/redis.log";
Change dir./To dir/var/redis/6379;
To avoid "Redis unauthorized access Vulnerability", bind IP: The # bind 127.0.0.1 to: Bind 127.0.0.1, if you want to bind the intranet IP, directly appended "Space IP" can, but do not recommend binding IP, However, you can add a redis access password to limit, modify the Requirepass value to set the Redis access password: Requirepass yourredispasswd 3, boot, configure Redis service:
Redis-server/etc/redis/6379.conf
①, Firewall open 6379 ports:
#为public域开放tcp协议的6379端口
firewall-cmd--zone=public--add-port=6379/tcp--permanent
#为public域添加http服务
Firewall-cmd--zone=public--add-service=http--permanent
#重启firewall服务
firewall-cmd--reload
②, add Redis service and set boot up:
Echo-e "redis-server/etc/redis/6379.conf\n" >>/etc/rc.local
So the Redis service is completed.