Notes for installing the lnmp environment by bogo

Source: Internet
Author: User

Notes for installing the lnmp environment by bogo

Video tutorial address: https://chuanke.baidu.com/v5659343-234411-1698133.html

Create a virtual machine


Note: After the configuration is complete, click Finish (the reason is that the selected custom settings are not configured properly)


Install contos6.5














Click Next




View network:



Modify network:
Restart the network:




Preparations before Lnmp installation:





Install nginx

1. Create a user group: groupadd www

2. (-g user group-M does not create home directory-s is not allowed) create user: useradd-g www-M-s/sbin/nologin






2. Install nginx

./Configure -- prefix =/usr/local/nginx -- user = www -- group = www -- with-http_ssl_module -- with-http_gzip_static_module -- with-pcre




Execute these commands after each installation to see what is missing:




Make & make install






Enable nginx

Ps-ef | grep nginx


View port

Netstat-nltp




Disable Firewall




Install mysql






1. create user groups and users: groupadd-r mysql & useradd-r-g mysql-s/bin/false-M mysql

(Create a user named mysql with no logon permission and a user group named mysql and add the mysql user to the mysql user group)




2,

Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \

-DMYSQL_UNIX_ADDR =/tmp/mysql. sock \

-DMYSQL_USER = mysql \

-DDEFAULT_CHARSET = utf8 \

-DDEFAULT_COLLATION = utf8_general_ci \

-DWITH_MYISAM_STORAGE_ENGINE = 1 \

-DWITH_INNOBASE_STORAGE_ENGINE = 1 \

-DWITH_DEBUG = 0 \

-DWITH_READLINE = 1 \

-DWITH_EMBEDDED_SERVER = 1 \

-DENABLED_LOCAL_INFILE = 1 \




After resolving the error, compile:

Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \

-DMYSQL_UNIX_ADDR =/tmp/mysql. sock \

-DMYSQL_USER = mysql \

-DDEFAULT_CHARSET = utf8 \

-DDEFAULT_COLLATION = utf8_general_ci \

-DWITH_MYISAM_STORAGE_ENGINE = 1 \

-DWITH_INNOBASE_STORAGE_ENGINE = 1 \

-DWITH_DEBUG = 0 \

-DWITH_READLINE = 1 \

-DWITH_EMBEDDED_SERVER = 1 \

-DENABLED_LOCAL_INFILE = 1 \



3. Compile and install: make & make install



Cd

4. cd/usr/local/mysql


5. initialize mysql

./Mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data


6. The default configuration file path for mysql is/etc/my. cnf. We copied and installed the default configuration file.




Cp my-huge.cnf/../etc/my. cnf




7. Use vim to open the MySQL configuration file.




8. Enable mysql

./Support-files/mysql. server start





Enter the mysql client

Bin/mysql-uroot-p



Is the first method:

[Not tested] Method 2: add the bin in the mysql installation directory to the Environment Variable

Echo 'export PATH =/usr/local/mysql/bin: $ path'>/etc/profile

Source/etc/profile

Enter the following command on the mysql client.

Mysql-uroot-p




10. log on to mysql in the official environment


Disable Anonymous Logon:








Install php


1. Download
2. Decompress
3. The configuration (compile parameters) uses the user created by nginx.

. /Configure -- prefix =/usr/local/php -- enable-fpm -- with-fpm-user = www -- with-fpm-group = www -- with-config-file-path = /usr/local/php/etc -- disable-ipv6 -- with-libxml-dir -- with-openssl -- with-zlib -- with-curl -- with-gd -- with-jpeg-dir -- -png-dir -- with-freetype-dir -- with-gettext -- disable-json -- enable-mbstring -- with-mysql -- with-mysqli -- enable-embedded-mysqli -- with-pdo -mysql -- with-pcre-dir -- enable-mysqlnd


Error 1: yum install libxml2-devel-y


Error 2:


Error 3:


Error 4:


Error 5:




4. Compile and install

Make & make install



5,

Cd/usr/local/php/etc


Mv php-fpm.conf.default php-fpm.conf


Cd/home/php


Cp php. ini-development/usr/local/php/etc/php. ini

Enable php

6. Check whether the installed php can be used to write php code.



Create a PHP file in the server







Restart nginx after modifying the configuration file.

Killall nginx kill Process

./Sbin/nginx start


Visit again. The page cannot be found, or nginx is not configured. Restart nginx after configuration.


Not mature, it is best not to change the root directory


7. Test the connected database

Open the index. php file in nginx



8. You do not need to learn

Bogo said that the online environment needs to be added (the real online environment also needs to handle security issues and help with O & M configuration)

Nginx, mysql, and php startup scripts (you can find bogo to ask for scripts)

Configuration of Nainx, mysql, and php



Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.