LNMP configuration (Linux (CENTOS7). ngnix.mariadb.php (Php-fpm,phpmyadmin))

Source: Internet
Author: User
Tags fpm phpinfo file permissions phpmyadmin

LNMP (linux,nginx,mariadb,php), here take Centos7 as an example, root permission operation, installed in Yum mode. A few notes:

    • Domain name resolution. If you later need to test your installation with a domain name, be sure to resolve the settings in advance, such as some domain name vendors or host vendors providing parsing capabilities. If you use IP tests, you can ignore them.
    • MARIADB is the open source community version of MySQL, followed by the GPL;
    • Centos7 Use the SYSTEMD Management service as follows:
      Systemctl enbale/is-enable/disable/start/restart/stop/status/reload/--failed  Servicename.service

enbale/is-enable/disable/start/restart/stop/status/reload/-- Failed corresponding to self-start/query self-start status/no-boot/immediate/Immediate restart/immediate stop/Status query/Reload Configuration/Query start failed project , service name (servicename) is also not added. Services.

    • This example is edited in the Nano editor and is commonly used in the following ways:

Nano xx Open a file named XX if it does not exist create a file named XX
Ctl+x exit and ask (ask when the content was modified)-n do not save and exit Y Save and ask whether to rename C cancel this operation
Ctrl+o Save

Installation

Installing NMP (nginx-mariadb-php)

Yum Install nginx mariadb mariadb-server php php-fpm phpmyadmin

Set the boot up and start the service immediately:

Systemctl enable Nginx mariadb php-fpm && systemctl start Nginx mariadb php-fpm

The following PHP extensions can be installed:

Yum Install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt  Php-bcmath Php-mhash Libmcrypt

Configuration

1.MARIADB configuration:

Mysql_secure_installation

Enter > Follow the prompts enter y> 2 times password > return > Follow the prompts to enter y> last appearance:Thanks for using mariadb!

2.phpmyadmin configuration:
Copy the phpMyAdmin directory to the Nginx home directory, take/usr/share/nginx/html/as an example, CentOS installs the phpMyAdmin under the Yum under/usr/share:

CP /usr/share/phpmyadmin//usr/share/nginx/html/;

XX for convenience, you can change the phpMyAdmin to phpMyAdmin or other names. If you change the name, then the Nginx configuration should be changed to the corresponding directory name.

3.PHP-FPM configuration:
Edit/etc/php-fpm.d/www.conf as follows:

user == Nginx #修改组为nginx


4. Nginx Configuration:
If there are no conf files in the/etc/nginx/conf.d/, copy one (here is an example named Dfault):

CP /etc/nginx/nginx.conf.default/etc/nginx/conf.d/default.conf

or create a conf file directly under/etc/nignx/conf.d/(if there is no conf file under conf.d/) , with the following content:

Server {Listen the; # The default port is server_name 1wei. cc www.1wei.cc; # Fill in the domain root after server_name here/usr/share/nginx/ HTML; #ngnix default home directory, can modify location according to the specific situation/{index index.php index.html index.htm;# add index.php} location/phpMyAdmin {#phpmyadmin directory, change the index index.php as appropriate; } Location~\.php$ {fastcgi_pass127.0.0.1:9000;    Fastcgi_index index.php;    Fastcgi_param script_filename $document _root$fastcgi _scipt_name;  Include Fastcgi_params; }}


To ensure that permissions are met, change the file permissions in the Ngnix directory,

chown Nginx.nginx/usr/share/nginx/html-r

Test

After configuration, restart all services before testing

Systemctl Restart Nginx mariadb php-fpm


Test Nginx:

Nginx-file /etc/nginx/file /etc/nginx/nginx.conf test is successful

Log in to the website to test, depending on the situation, open the domain name or IP in the browser. such as www.1wei.cc

Test PHP parsing:
To add a phpinfo test file:

nano/usr/share/nginx/html/phpinfo.php

Add the following code:

<? phpphpinfo ();? >

Open (take 1wei.cc for example) 1wei.cc/phpinfo.php, you can see the PHP details page.

PhpMyAdmin test, open 1wei.cc/phpmyadmin/with the phpMyAdmin name unchanged in the home directory as an example


LNMP configuration (Linux (CENTOS7). ngnix.mariadb.php (Php-fpm,phpmyadmin))

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.