- Login, upgrade applications, query and close SELinux
Yum Update
0 VI /etc/selinux
- Add non-root user
-A-G Wheel Deploy
- ssh config
ssh [email protected]123.456 . ssh -keygenmkdir ~/.SSHSCP ~/.ssh/id_rsa.pub [Email protected]78.90 :touch ~/.ssh/authorized_ Keyscat ~/id_rsa.pub >> ~/.ssh/authorized_keyschown -R Deploy: Deploy ~/.sshchmod .sshchmod 600 ~/.ssh/authorized_keys
- Disable password and root login, first determine sudo permissions, open/etc/ssh/sshd_config, modify the value of passwordauthentication to No, uncomment. Modified Permitrootlogin Ibid. Restart sshd.
Service sshd Restart
- PHP, PHP-FPM installation
sudo rpm-uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm; sudo rpm-uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm; sudo Yum Install php-fpm php-cli php-gd php-mbstring php-mcrypt php-mysqlnd php-opcache php-pdo php-devel;
- PHP-FPM Configuration
sudo vi /etc/php-fpm.conf// Modify the following two, the 1-minute process failed to reach 10, the graceful restart of 1m
There is a include=/etc/php-fpm.d/*.conf in the configuration file, indicating that the pool definition is in the PHP-FPM.D directory
VI/etc/php-fpm.d/www.conf//modify users, try each site one useruser =Deploygroup=Deploy//Port with Nginx request processingListen =127.0.0.1:9000//server memory divided by process consuming memoryPm.max_children = -//number of readiness processes that are automatically opened when the service is turned onPm.start_servers =3//maximum number of processes per poolPm.max_requests = +//Slow LogSlowlog =/path/to/Slowlog.logrequest_slowlog_timeout=5s//Last Restart Servicesudo service php-fpm restart
Chkconfig PHP-FPM on
- Installing Nginx
sudo Yum Install Nginx; sudo systemctl enable Nginx.service; sudo systemctl start nginx.service;
- Create site Directory and log directory
mkdir -p/home/deploy/apps/example.com/current/publicmkdir -p/home/deploy/apps/ Logschmod -R +rx/home/deploy
Establish/etc/nginx/conf.d/example.conf
Server {Listen the; server_name example.com; Index index.php; Client_max_body_size 50M; Error_log/home/deploy/apps/logs/Example.error.log; Access_log/home/deploy/apps/logs/Example.access.log; Root/home/deploy/apps/example.com/current/Public ; Location/{try_files $uri $uri/ /Index.php$is_args$args; } Location~\.php {try_files $uri=404; Fastcgi_split_path_info^ (. +\.php) (/.+)$; Include Fastcgi_params; Fastcgi_param script_filename $document _root$fastcgi_script_name; Fastcgi_param script_name $fastcgi _script_name; Fastcgi_index index.php; Fastcgi_pass127.0.0.1:9000; }}
- Restart
sudo systemctl Restart Nginx.service
sudo chkconfig nginxon// If permissions fail, start sudo/usr/local/nginx/sbin/nginx-c with root privileges /usr/ Local/nginx/conf/nginx.conf
Server Environment Configuration NGINX/PHP/PHP-FPM