In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to install lnmp in linux. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Nginx is a high-performance HTTP and reverse proxy web server that distributes source code as a BSD-like license and is known for its stability, rich feature set, sample configuration files, and low consumption of system resources.
First, install nginx
* nginx's official website: *
* * http://nginx.org/en/download.html****
* Mainline version* * mainline version *
* Stable version* * stable version *
* Legacy versions* * Heritage version / Historical version *
1. download
Before installation, confirm to install the direct yum install wget gcc gcc-c++ pcre-devel zlib-devel openssl openssl-devel that the extension does not have.
[root@localhost ~] # cd / usr/local/src/ [root@localhost src] # wget http://nginx.org/download/nginx-1.12.2.tar.gz
two。 Decompression
[root@localhost src] # tar zxvf nginx-1.12.2.tar.gz
/ * * cancel Debug compilation mode START***/
Cd nginx-1.12.2
Vi auto/cc/gcc # comment out this sentence and cancel the Debug compilation mode in line 172 # CFLAGS= "$CFLAGS-g"
/ * * cancel Debug compilation mode END*/
\ 3. Pre-compilation
Cd nginx-1.12.2. / configure-prefix=/usr/local/nginx-- with-http_ssl_module-- with-http_v2_module-- with-http_stub_status_module-- with-pcre-- with-http_gzip_static_module-- with-http_dav_module-- with-http_addition_module-- with-http_sub_module-- with-http_flv_module-- with-http_mp4_module
explain
-with-http_gzip_static_module: supports compression
-with-http_stub_status_module: support nginx status query
-with-http_ssl_module: supports https
-with-pcre: in order to support the rewrite rewriting function, pcre must be established
-with-http_dav_module # enable support (add PUT,DELETE,MKCOL: create collections, COPY and MOVE methods)
-with-http_addition_module # enable support (as an output filter, support for incomplete buffering, partial corresponding requests)-with-http_sub_module # enable support (allows some other text to replace some text in the corresponding Nginx)-with-http_flv_module # enable support (support for flv video files)-with-http_mp4_module # enable support (support for mp4 video files Provide pseudo-streaming media server support)
* * make-j 4 & & make install 4 core compilation *
4. [root@localhost src] # make & & make install
5. Add a system variable (convenient to start and stop services)
[root@localhost nginx-1.12.2] # vim / etc/profile
I usually add export PATH=/usr/local/nginx/sbin:$PATH on line 56
Restart configuration source / etc/profile
[root@localhost nginx-1.12.2] # nginx- V
* * add softlink ln-s / usr/local/nginx/sbin/nginx / usr/local/sbin/****
* generate a service startup script *
* * vim / etc/init.d/nginx****
#! / bin/bash# chkconfig:-99 "description: Nginx Service Control ScriptPROG=" / usr/local/nginx/sbin/nginx "PIDF=" / usr/local/nginx/logs/nginx.pid "case" $1 "in start) $PROG;; stop) kill-3 $(cat $PIDF);; restart) $0 stop & > / dev/null if [$?-ne 0]; then continue Fi $0 start;; reload) kill-1 $(cat $PIDF);; *) echo "Userage: $0 {start | stop | restart | reload}" exit 1esacexit 0
Configuration service boot automatically starts [root@localhost ~] # chmod + x / etc/init.d/nginx [root@localhost ~] # chkconfig-add nginx [root@localhost ~] # chkconfig nginx on
Start / usr/local/nginx/sbin/nginx for the first time
II. Install mysql 5.7,
Using rpm has the advantage of not having to configure so many things. Don't worry about the configuration.
[root@localhost ~] # cd / usr/local/src/ [root@localhost src] # wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm[root@localhost src] # rpm-ivh mysql57-community-release-el7-8.noarch.rpm [root@localhost src] # yum-y install mysql-server
(* you can also specify the installation directory * * yum * *-installroot=/usr/local/mysql-releasever=/*-y install mysql-server can study * *) * *
Just follow the steps to install it.
Default profile path: configuration file: / etc/my.cnf log file: / var/log/var/log/mysqld.log service startup script: / usr/lib/systemd/system/mysqld.service
Socket file: / var/run/mysqld/mysqld.pid
Start the mysql service
Service mysqld restart
Reset password
[root@localhost ~] # grep "password" / var/log/mysqld.log
You can see that entering the mysql-u root-p password to log in for the first time, you need to reset the password or nothing can be done.
Next, reset the password: 5.7.20 for security, the password must contain numeric alphanumeric symbols.
* alter user 'root'@'localhost' identified by' rootstocks in 2018
You can also add new users directly.
Grant all on. To 'rootadmin'@'%' identified by' Root@@' with grant option
Add root users to specify that you can log in to any IP. If you want to restrict only the specified IP login, please replace% with the IP address.
Finally, remember to refresh permissions.
Flush privileges
Third, install php
Required plug-in package
Yum-y install gcc gcc-c++ libxml2 libxml2-devel bzip2 bzip2-devel libmcrypt libmcrypt-devel openssl openssl-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel readline readline-devel libxslt-devel perl perl-devel psmisc.x86_64 recode recode-devel libtidy libtidy-devel epel-release libmcrypt-devel autoconf
1. download
[root@localhost ~] # cd / usr/local/src/ [root@localhost src] # wget http://cn2.php.net/distributions/php-5.6.32.tar.gz
two。 Decompression
[root@localhost src] # tar zxvf php-5.6.32.tar.gz
\ 3. Pre-compilation
Enter the directory [root@localhost src] ``# cd php-5.6.32
Create php-fpm users and disable login; [root@localhost php-5.6.32] # useradd-s / sbin/nologin php-fpm
/ configure-- prefix=/usr/local/php-- sysconfdir=/usr/local/php/etc-- with-config-file-path=/usr/local/php/etc/-- with-fpm-user=php-fpm-- with-fpm-group=php-fpm-- enable-fpm-- with-mysql=mysqlnd-- with-mysqli=mysqlnd-- with-pdo-mysql=mysqlnd-- with-mhash-- with-openssl-- with-zlib-- with-bz2-- with-curl-- with-libxml-dir-- With-gd-with-jpeg-dir-with-png-dir-with-zlib-enable-mbstring-with-mcrypt-enable-sockets-with-iconv-dir-enable-zip-with-pcre-dir-with-pear-enable-session-enable-gd-native-ttf-enable-xml with-freetype-dir enable-gd-jis-conv enable-inline-optimization enable-shared enable-soap Enable-bcmath-enable-sysvmsg-enable-sysvsem-enable-sysvshm-enable-mbregex-enable-pcntl-with-xmlrpc-with-gettext-enable-exif-with-readline-enable-ftp-enable-redis
Error mcrypt.h can not be found, install the libmcrypt-devel package, the default yum source, there is no this package, need to install the epel extension source before you can install.
[root@localhost php-5.6.32] # yum install-y epel-release [root@localhost php-5.6.32] # yum install-y libmcrypt [root@localhost php-5.6.32] # yum install-y libmcrypt-devel
Execute. / configure again with no error prompt, Thank you for using PHP appears, and configure OK.
Use echo $? Check to see if it is installed correctly; [root@localhost php-5.6.32] # make & & make install
[root@localhost php-5.6.32] # echo $?
0 indicates that the result of the previous step is successful.
Configuration file
You need to copy the php.ini file from the current directory to the installation directory etc of php
[root@localhost php-5.6.32] # cp php.ini-production / usr/local/php/etc/php.ini
Php.ini files are php.ini-development (development) and php.ini-production (production) under the package directory.
Copy php startup script, php-fpm configuration file, change php-fpm permission to 755; add php-fpm boot boot
[root@ php-5.6.32] # cp / usr/local/src/php-5.6.32/sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm [root@ php-5.6.32] # mv / usr/local/php/etc/php-fpm.conf.default / usr/local/php/etc/php-fpm.conf (that is, remove the ending. Default) [root@ php-5.6.32] # chmod 755 / etc/init.d/php-fpm [root@lphp-5.6.32] # chkconfig-- add php-fpm [root@lphp-5.6.32] # service php-fpm start Starting php-fpm done [root@php-5.6.32] # chkconfig php-fpm on
Add the installation directory of php to the environment variable of the system on the last line
Vim / etc/profile
Export PATH=/usr/local/php/bin:$PATH
Source / etc/profile reload
[root@localhost] # php-v PHP 5.6.32 (cli) (built: Mar 12 2018 17:43:15) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies complete the next step is the test
-- php- installed successfully
Test enter your ip in the address bar. Then test whether the PHP installation is successful. Make sure that both nginx and PHP are running.
Write a test page
Enter the html cd / usr/local/nginx/html/ of nginx
Edit vim index.php
\ 2. Configure nginx
Two core configurations are added to the nginx.conf
Vim / usr/local/nginx/conf/nginx.conf
Find location and add index.php
Transfer the request to port 9000 of php to make sure that both nginx and PHP are running.
Location ~ .php ${
Root html; fastcgi_pass 127.0.0.1 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME
Fastcgi_script_name; include fastcgi_params;}
At this point, the installation of lnmp is complete.
On how to install linux lnmp to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.