Server Environment Configuration NGINX/PHP/PHP-FPM

Source: Internet
Author: User
Tags server memory ssh config

  1. Login, upgrade applications, query and close SELinux
    Yum Update
    0 VI /etc/selinux

  2. Add non-root user
    -A-G Wheel Deploy

  3. 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 

     

  4. 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

  5. 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;

  6. 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

  7. Installing Nginx
    sudo Yum Install Nginx; sudo systemctl enable Nginx.service; sudo systemctl start nginx.service;

  8. 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

  9. 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; }}

  10. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.