LNMP (linux,nginx,mariadb,php), here take Centos7 as an example, root permission operation, installed in Yum mode. A few notes:
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))