Linux system Lnmp Linux, PHP, MySQL environment (for beginners to build a Web environment under Linux)

Source: Internet
Author: User
Tags chmod vps

One

The first thing to explain is what LNMP,LNMP originated from Lamp,lamp is the abbreviation for Linux+apache+mysql/mariadb+perl/php/python, which replaces the Web server's Apache with less resource consumption, More stable Nginx, so LNMP is the abbreviation of Linux+nginx+mysql/mariadb+perl/php/python;

Refer to the introduction of LNMP one-click installation package website for a brief introduction, why Choose LNMP

Lnmp What is a one-click installation package?

LNMP One-click installation package is a Linux shell that can be used for Centos/rhel/fedora/aliyun/amazon, Debian/ubuntu/raspbian/deepin/mint Linux A LNMP (nginx/mysql/php), Lnmpa (Nginx/mysql/php/apache), LAMP (apache/mysql/php) Production environment Shell program is installed on VPS or standalone host.

Why do we need it?
Compiling the installation requires a large number of commands, which can be time-consuming to configure the production environment.
No Linux webmaster or Linux novice wants to use Linux as a production environment ...

What advantages and functions does it have?
No need for one input command, no attendance, compile and install optimized compilation parameters, improve performance, solve unnecessary inter-software dependencies, especially for configuration automatic optimization.

Support Custom Nginx, PHP compile parameters and Web site and database directory, support generate Letseecrypt certificate, LNMP mode support multiple PHP version, support to install NGINX/MYSQL/MARIADB/PUREFTPD server separately, At the same time provide some useful auxiliary tools such as: Virtual Host management, FTP user management, Nginx, MYSQL/MARIADB, PHP upgrade, common cache components Redis/xcache, such as installation, reset the MySQL root password, 502 Automatic restart, log cutting, SSH protection Denyhosts/fail2ban, backup and many other useful scripts.

How do I get it?
You are free to download and use it on a VPS or standalone server, as a real production environment or test environment.

Why do we use the LNMP architecture?
With the advantages of Linux, PHP, and MySQL, we don't have to say much.

Nginx is a small and efficient Web server software under Linux, was developed by Igor Sysoev for the second visit to Russia rambler.ru site, has been in some large Russian websites for many years, the current many domestic and foreign portals, Industry sites are also in use Nginx, quite stable.

Nginx is quite stable, features rich, simple installation configuration, low system resources

Here I need to say, Nginx and Apache to compare, under the same conditions, Nginx occupies less system resources, can carry more concurrency, but nginx pseudo-static rules set compared to IIS and Apache slightly complex;

Second, installation

Installation is simple, one command is enough:wget-c http://soft.vpser.net/lnmp/lnmp1.4.tar.gz && tar zxf lnmp1.4.tar.gz && CD lnmp1.4 &&./install.sh

The period will let you set the MySQL password, PHP version number, whether to enable logging and so on;

When the install Lnmp V1.4 completed! appears Enjoy it. Then the instructions have been installed successfully.

Third, add the site

Input:lnmp vhost Add

Enter the Add Virtual Host command, which is the first to enter your primary domain. Example: 91wuxia.com (do not take www)

The second section creates the virtual host folder, if 91wuxia.com is entered. Default prompt to create Www.91wuxia.com folder;

(Note: This folder is created and the storage location is/home/wwwroot/www.91wuxia.com.)

Then prompts whether to add pseudo-static rules, you can choose the default, if you need to customize the program, then write a name you know, then add the rules, but to the. conf suffix file name, such as 91wuxia.conf

When all options have been selected, enter confirm to start creating the virtual host.

Add the added domain name, directory, pseudo-static, log, database, FTP and other related information;

If it is local debugging, you access localhost, the open is not you create is the/home/wwwroot/www.91wuxia.com folder directory, open the file under/home/wwwroot/default, Of course you can open localhost/phpmyadmin for database management;

If local debugging, you need to do the hosts to hijack their own IP, that is, domain redirection, the following methods:

Open C:\WINDOWS\system32\drivers\etc, it is best to open with notepad++, Notepad save easy to appear error;

127.0.0.1 Domain Name
Cases:

127.0.0.1 www.91wuxia.com

The middle is a space, if there is a subdomain, another line, the same format can be;

If is the remote server/vps/the virtual host, binds the domain name to your resolution address (IP/CNAME), the direct access is possible;

Iv. mysterious. User.ini files and chattr commands

When all the build environments are set up, when you are ready to upload the program, you will find that there is no read and write permission;

Switch root, use chmod-r 777 to give the folder authorization, generate error prompts;

This is mysterious. User.ini appear, you will find omnipotent even can delete their own root privileges, cannot forcibly delete. user.ini file;

Multi-search, chattr-i unlock command to find

Enter chattr-i/web site path/.user.ini

Here the path can be relative or absolute, novice really do not understand can use absolute path, example:

Chattr-i/home/wwwroot/www.91wuxia.com/.user.ini

You just need to replace the www.91wuxia.com with your own domain folder name, you can;

Then chmod-r 777/folder path/authorization, now you can control the folder.

Remember to enter chattr +i/website Path/.user.ini, and then lock.

V. Pseudo-static rules

Hardships of the Web set up, can also visit, look at the column page, eh? How is 404 unreachable?

Yes, I said before, pseudo-static is not set.

Pseudo-static rules are stored in the following location:/usr/local/nginx/conf/vhost/domain name. conf

Here is your virtual host configuration file, if you have other two-level domain names need to bind, it is necessary to add in this, the default is not binding mobile version of the two-level domain name, such as m.91wuxia.com, the domain name needs to be added manually

Remember just said, in the addition of virtual host, named pseudo-static rules file, yes, is 91wuxia.conf, this configuration file is stored in the parent conf directory, there are many default site pseudo-static rules, such as Dede,diguo,dz and so on

Direct vi/usr/local/nginx/conf/91wuxia.conf Copy the pseudo-static rules into the Save (vi Operation command please Baidu a bit)

Re-start Nginx

Restart command:/etc/init.d/nginx restart

You can also use the LNMP command:

Lnmp Stop shutdown

Lnmp start again to enable restart

Well, this is the whole process of setting up a Web site on a VPS, and some of the problems encountered;

Linux, PHP, MySQL environment (for beginners to build a web-generated environment under Linux) under the LNMP system.

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.