Nginx network service builds lnmp

Note: (blue is the step   and red is the command)

Nginx version:

Community Edition www.nginx.org

    Enterprise Edition www.nginx.com (acquired by F5 )

  tengine tengine.taobao.org

Step 1: Turn off the firewall, security mechanism

sysytemctl stop firewalld

iptaoles -F

setenforce 0

Step 2: Install the required packages (yum installation) and create users and groups at the same time

pcre-devdel zlib-devdel openssl-devdel

useradd -M -s /sbin/nologin nginx

third step:

Release the nginx package  tar xf nginx-1.14.2.tar.gz -C/usr/src/

Compile and install: cd /usr/src/nginx-1.14.2/

enter:

 ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module && make && make install

Step 4: Redirect

 ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/

Start: nginx -t      nginx    

Step 5: Modify the nginx main configuration file

vim /usr/local/nginx/conf/nginx.conf

  server { // Monitoring configuration of web service

        listen 80; // Listening address and port ( IP : PORT )

server_name www.crushlinux.com; // Website name ( FQDN )

charset utf-8; // The default character set of the web page

 

        location / { // with directory configuration

            root html; // The location of the root directory of the website is in the html of the installation location

            index index.html index.htm; // Default home page (index page)

        }

  location /status {

  stub_status on; // Turn on the status statistics function

  access_log off; // Turn off logging at this location

        }

error_page 500 502 503 504 /50x.html; // Internal error feedback page

        location = /50x.html { // Error page configuration

            root   html;

        }

Step 6: Start   nginx    

------------------------------------------------------------------------------------------------------------------------

install mysql database

Step 1: Install mysql mysql-server mariadb mariradb-server ncurses-devel cmake with yum

Step 2 : Create Users and Groups  

useradd -M -s /sbin/nologin mysql

Step 3: Unpack

tar xf mysql-5.7.24.tar.gz. -C /usr/src

the fourth step:

prevent it from popping  

Create a user mkdir /usr/loacl/booat

cd  /usr/local/booat

wget https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz

tar xf boost_1_59_0.tar.gz

Step 5: Compile and install (note the spaces)

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DSYSCONFDIR=/etc-DWITH_BOOST=/usr/local/boos t&& make && make install

Step 6: Adjustment after installation

[root@nginx~]# cd /usr/local/mysql/

[root@nginxmysql]#chown -R mysql:mysql  ./

[root@nginxmysql]# vim /etc/my.cnf

[mysqld]

datadir=/usr/local/mysql/data

socket=/tmp/mysql.sock

[mysqld_safe]

log-error=/usr/local/mysql/data/mysql.log

pid-file=/usr/local/mysql/data/mysql.pid

Step 7 : Initialize the database

 ./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize

Step 8 : Set Environment Variables

Vim /etc/profile

PATH=$PATH:/usr/local/mysql/bin

Step 9: Start

source /etc/profile

Step 10 : Add system services

[root@nginx mysql-5.7.24]# cp support-files/mysql.server /usr/local/mysql/bin/mysqld.sh

[root@nginx mysql-5.7.24]#chmod +x /usr/local/mysql/bin/mysqld.sh

-----------------------------------------------------------------------------------------------------------------------

php parsing environment  

Step 1: Install with yum

gd libxml2-devel libjpeg-devel libpng-devel

Step 2 : Compile and install

[root@nginx~]# tar xfphp-5.6.39.tar.gz -C /usr/src/

[root@nginx~]# cd /usr/src/php-5.6.39/

[[email protected]]# ./configure --prefix=/usr/local/php5 --with-gd --with-zlib --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/usr/local/php5 --enable-mbstring --enable-fpm --with-jpeg-dir=/usr/lib && make && make install

 Step 3 : Adjust

[[email protected]]#cp php.ini-production /usr/local/php5/php.ini

[[email protected]]# ln -s /usr/local/php5/bin/* /usr/local/bin/

[[email protected]]# ln -s /usr/local/php5/sbin/* /usr/local/sbin/

Step 4 : Install a package,

[root@nginx~]# tar xf zend-loader-php5.6-linux-x86_64_update1.tar.gz -C /usr/src/

[root@nginx~]# cd /usr/src/zend-loader-php5.6-linux-x86_64/

[root@nginx zend-loader-php5.6-linux-x86_64]# cp ZendGuardLoader.so /usr/local/php5/lib/php/

 

[root@nginx zend-loader-php5.6-linux-x86_64]#vim /usr/local/php5/php.ini

zend_extension=/usr/local/php5/lib/php/ZendGuardLoader.so

zend_loader.enable=1

Step 5 : Modify the main configuration file

[root@nginx~]# cd /usr/local/php5/etc/

[root@nginxetc]# cp php-fpm.conf.default php-fpm.conf

[root@nginxetc]#useradd -M -s /sbin/nologin php

Step 6 : Modify  

[root@nginxetc]# vim php-fpm.conf

 25 pid = run/php-fpm.pid// confirm pid file location

 149 user = php// Running user

 150 group = php // run group

246pm.start_servers = 20// Number of processes started at startup

251pm.min_spare_servers = 5//The minimum number of idle processes

256pm.max_spare_servers = 35// Maximum number of idle processes

241pm.max_children = 50// Maximum number of idle processes

Step 7 : Start the service and view

[root@nginxetc]# /usr/local/sbin/php-fpm

[root@nginxetc]# netstat -anpt |grep php-fpm

tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      23027/php-fpm.conf) 

 

 

 

 

 

 

 

 

(*Do not repost, copy without permission)

 

Reprinted in: https://www.cnblogs.com/123456likun/p/11525698.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326443049&siteId=291194637