Nginx Series-2. Configuring the Lnmp (Linux, Nginx, MySQL, PHP) architecture

Source: Internet
Author: User
Tags fpm create database nginx server nginx reverse proxy

Nginx Series-2. Configure LNMP (Linux, Nginx, MySQL, PHP) schema directory-Nginx series

Nginx Series -1.linux Installation Nginx
Nginx Series-2. Configuring the Lnmp (Linux, Nginx, MySQL, PHP) architecture
Nginx Series-3. Configuring Nginx Virtual Host
Nginx Series -4.nginx log configuration and log cutting
Nginx Series-5. Configure the Nginx anti-theft chain
Nginx Series-6. Configuring Nginx HTTPS
Nginx Series-7. Configuring Nginx using UWSGI support web.py framework
Nginx Series-8. Configuration nginx+apache for dynamic and static separation
Nginx Series-9. Configuring NFS for static and dynamic separation of Nginx
Nginx Series-10. Using Nginx to build forward proxy service
Nginx Series-11. Configuring Nginx Reverse proxy and load balancing

Experimental Environment
A minimized CentOS 7.3 virtual machine

First, install the package
yum install -y epel-*yum install -y nginx mariadb-server php php-fpm php-mysql php-pdo php-pdo_dblib php-json php-devel php-gd php-pear php-xml php-pecl-zip wget vim
Second, the configuration Nginx support PHP
  1. nginxthe established home directory

    mkdir /var/wwwrootcd /var/wwwrootecho -e hello_world >> index.htmlecho -e "<?php phpinfo(); ?>" >> info.php

  2. Editing a nginx configuration file

    vim /etc/nginx/nginx.conf

  3. modifying nginx home directories and indexes
    3.1. http server Change the value below root to /var/wwwroot
    3.2. Under http server add

    index index.php index.html index.htm

  4. Under below http server , add the following:

    location ~ \.php$ {    fastcgi_pass    127.0.0.1:9000;    fastcgi_index   index.php;    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;    include         fastcgi_params;}

  5. Start nginx and php-fpm

    systemctl start nginx php-fpm
  6. Shutting down the firewall

    setenforce 0systemctl stop firewalldsystemctl disable firewalld
  7. The host accesses Nginx
    Access http://[centos_ip]/info.php
Third, configure MySQL
    1. StartMySQL

      systemctl start mariadb
    2. Enter the following command to configureMySQL

      mysql_secure_installation
    3. Tips Enter current password for root (enter for none):
      Tap Enter

    4. Tips Set root password? [Y/n]
      Press Y , then set the password

    5. Tips Remove anonymous users?
      Meaning for是否删除匿名用户

    6. Tips Disallow root login remotely?
      Meaning for远程禁止root登录吗?

    7. Tips Remove test database and access to it?
      Meaning for删除测试数据库吗?

    8. Tips Reload privilege tables now?
      Meaning for现在重新加载特权表吗?

    9. Log in to MySQL database
      mysql -uroot -p

Iv. Download the wordpress test LNMP
    1. Download WordPress

      cd /var/wwwrootrm -rf index.htmlrm -rf info.phpwget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gztar -zxvf wordpress-4.9.4-zh_CN.tar.gzcp -rf /var/wwwroot/wordpress/* /var/wwwrootcd /var/wwwrootrm -rf wordpresschmod -R 777 *
    2. Log in to MySQL to create a database

      mysql -uroot -p
      CREATE DATABASE wordpress;
    3. Access Nginx Server on host
      Access http://[centos_ip]/
      Follow the prompts to install


Nginx Series-2. Configuring the Lnmp (Linux, Nginx, MySQL, PHP) architecture

Related Article

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.