Set up the LNMP server under Cnentos7 and set up lnmp under cnentos7
Centos 7 server Creation
Nginx Server
Mysql database
Nosql Redis
Language PHP (Framework: Laravel asynchronous: swoole)
Other git, jenkins, zabbix
PHP
Yum resource address
CentOS/RHEL 7.x:
Rpm-Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Rpm-Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
CentOS/RHEL 6.x:
Rpm-Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Rpm-Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
For fear of trouble, install all extensions
Yum-y install mod_php71w php71w-bcmath php71w-cli php71w-common php71w-dba php71w-devel php71w-embedded php71w-enchant php71w-fpm php71w-gd php71w-imap php71w-interbase php71w-intl php71w-ldap php71w-mbstring php71w-mcrypt php71w-mysql php71w-mysqlnd php71w-odbc php71w-opcache php71w-pdo php71w-pdo_dblib php71w-pear php71w-pecl-apcu php71w-tidy php71w-xml php71w-xmlrpc
Configuration
Vim/etc/php. ini
Mysql
Add Mysql Yum resource library
Yum localinstallBranch. Rpm
Replace branch with the desired file name. For example, if you want to install branchMysql57-community-release-el7-11.noarch.rpmThen branch should beMysql57-community-release-el7-11.noarch
Download the rmp file to the server
Execute the yum localinstall mysql57-community-release-el7-11.noarch.rpm
If the rmp file is not found, a prompt is displayed.
-Loaded plugins: fastestmirror
Cannot open: mysql57-community-release-el7-11.noarch.rpm. Skipping.
Nothing to do
It is normal to upload a file, locate the upload location, and execute the command again as follows:
Run sudo grep 'temporary password'/var/log/mysqld. log
If the result is normal, it will be similar to [Note] A temporary password is generated for root @ localhost:2x! Q-WeeG6H4The bold part is the allocated root password.
If this parameter is not modified, the Navicat connection cannot be used.
Your password has expired. To log in you must change it using a client that supports expired passwords
Next, modify the initial password.
Mysql-uroot-p
Mysql> alter user 'root' @ 'localhost' identified by 'password4you! ';
Better follow the new password policyThe password must contain at least one uppercase letter, one lowercase letter, a number, and a special character. The total password length must be at least 8 characters.
I cannot use the navicat link when setting 123456 myself. I don't know why.
Add the method for changing the root password of mysql.
You remember to change the root password to a new one.
After logging on to mysql-uroot-p
Alter user 'root' @ 'localhost' identified by 'password4you! '; Forgot the root password
Vi/etc/my. cnf is added at the end of the file
Skip-grant-tables
Restart mysql: service mysqld restart
In the skip-grant-tables settings, type mysql to enter mysql
In this case, you cannot change The password by using the alter user xxxx method. The following message is displayed: the MySQL server is running with The-skip-grant-tables option so it cannot execute this statement.
In this case, perform the following operations:
Mysql> USE mysql;
Mysql> UPDATE user SET Password = password ('new-password') WHERE User = 'root ';
Mysql> flush privileges;
Mysql> quit
This can be done before 5.7. After 5.7, the UPDATE statement must be changed
Update user set authentication_string = password ('000000') where user = 'root ';
Log configuration vim/etc/my. cnf
General_log = 1
General_log_file = "/learn/log/mysql_general.log"
Slow_query_log = 1
Long_query_time = 1
Slow_query_log_file = "/learn/log/slow_querys.log"
Basically, only the configuration of slow query is different from the previous one. After the configuration is complete, you need to create a log file, change the owner group to mysql, and then restart the service.
Error Handling
If an error occurs, the system prompts "See" if the service fails to be started."Systemctl status mysqld. service" and "journalctl-xe" for details.However, it is generally invisible. Check the error directly in less/var/log/mysqld. log.
Nginx
The built-in yum does not seem to contain nginx, but the yum that installs php has nginx, so you don't need to install the official pre-build package and use yum to install (yum install nginx ).
Nginx has not been installed for a long time. Wait for a while and continue.
How to use brute force for automatic start at startup
Vim/etc/rc. local
Insert
Service mysqld start
Service php-fpm start
Service nginx start