Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build lnmp Services

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)05/31 Report--

This article shows you how to build lnmp services, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

I. lnmp

That is, Nginx website service Nginx is a very lightweight HTTP server written by Russians, Nginx, pronounced "engine X", is a high-performance HTTP and reverse proxy server, but also an IMAP/POP3/SMTP proxy server.

Advantages: a high-performance, lightweight Web service software, high stability, low system resource consumption, high processing capacity for HTTP concurrent connections, a single physical server can support 30000 to 50,000 concurrent requests.

II. Installation Environment 2.1 install RHEL_6.5 under the virtual machine

Rhel-server-6.5-x86_64-ded

2.2 install DNS

Bind-9.8.2-0.17.rc.el6_4.6.x86_64.rpm

Bind-util-9.8.2-0.17.rc.el6_4.6x86_64.rpm

Bind-chroot-9.8.2-0.17rc1.el6_4.6_x86_64.rpm

Bind-libs-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm

2.3 install MySQL

Ncurses-devel-5.7-3.2009.2.8.el8.x86.rpm

Cmake:cmake-2.8.6.tar.gz

Mysql:mysal-5.5.22.tar.gz

2.4 install nginx

Nginx:nginx-1.6.0.tar.gz

2.5 install PHP

Libxml2-devel

Libjpeg-devel

Libpng-devel

Php:php-5.3.28.tar.gz

ZendGuarLoader:ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz

2.6 Video-on-demand system

SKYUC:SKYUC.v3.4.2.SOURCE

III. Topological diagram

4. Experimental code 4.1 to build DNS

Import RED HAT image file

4.1.1 install DNS

# cd / media/RHEL_6.5\ X86room64\ Disc\ 1/Packages/ enter the Packages of the image file

/ / install the package corresponding to bind

# rpm-ivh bind-9.8.2-0.17.rc.el6_4.6.x86_64.rpm

# rpm-ivh bind-util-9.8.2-0.17.rc.el6_4.6x86_64.rpm

# rpm-ivh bind-chroot-9.8.2-0.17rc1.el6_4.6_x86_64.rpm

# rpm-ivh bind-libs-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm

4.1.2 create a profile

# vim / etc/named.conf / / enter the configuration file

Options {

Directory "/ var/named"

/ / specify the working directory of the service and the path to the configuration file

}

Zone "benet.com" IN {/ / New Domain http://benet.com

Type master; / / Primary server domain type

File "benet.com.zone"

/ / specified file, which is a forward parsing file

}

4.1.3 establish a regional data file

# vim / var/named/benet.com.zone

$TTL 86400 / / time to Live record field, which is measured in seconds

@ SOA benet.com. Admin.benet.com. (/ / SOA record, the special character @, is the ORIGIN admin authorized host and manager mailbox.

2011030301 / / Update serial number

4H / / refresh time

30m / / retry delay

12H / / failure time

1D / / Life cycle of invalid resolution records

)

@ IN NS test.benet.com.

Test IN A 192.168.1.61

Www IN A 192.168.1.61

4.1.4 Verification

# service named restart / / restart named

# nslookup http://test.benet.com / / Domain name Resolution

4.2 set up MYSQL4.2.1 and install ncurses

# rpm-qa mysql-server mysql

/ / check whether the mysql service is installed on the system

# yum-y remove mysql / / Uninstall mysql if mysql is installed

# cd / media/RHEL_6.5\ X86room64\ Disc\ 1/Packages/ enter the Packages of the image file

# rpm-ivh ncurses-devel-5.7-3.2009.2.8.el8.x86..rpm / / install ncurse

4.2.2 upload cmake source package compilation and installation

# tar zxf cmake-2.8.6.tar.gz / / decompress

# cd cmake-2.8.6 / / enter cmake

#. / configure / / define the path

# gmake & & gmake install / / compile the source code and install the line source code

4.2.3 decompress the MySQL source code packet

# tar zxf mysql-5.5.22.tar.gz-C / usr/src/ extract mysql to / usr/src directory

# cd / usr/src/mysql-5.5.22/ enter / usr/src/mysql-5.5.22

# cmake / / specify the installation path of mysql, and point to

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql / / mysql configuration file

-DDEFAULT_CHARSET=utf8 / / directory / etc/mysql, which specifies the default character set

-DDEFAULT_COLLATION=utf8_general_ci / / is utf8, set the default row-DWITH_EXTRA_CHARSETS=all

# make & & make install / / compile the source code and perform the source code installation

4.2.4 optimize adjustments and establish configuration files

# rm-rf / etc/my.cnf/ / delete / etc/my.cnf/ configuration

# cp

/ usr/src/mysql-5.5.22/support-files/my-medium.cnf / etc/my.cnf

/ / copy files to / etc/my.cnf to add system services

# cp / usr/src/mysql-5.5.22/support-files/mysql.server

/ etc/rc.d/init.d/mysqld / / copy

# chmod + x / etc/rc.d/init.d/mysqld / / give executable permissions

# chkconfig-- add mysqld / / add mysqld service

4.2.5 set environment variables, you can use the mysql command in any directory

# echo "PATH=$PATH:/usr/local/mysql/bin" > > / etc/profile / / output the file under the environment variable to / etc/profile

4.2.6 initialize the database and create a database user

# groupadd mysql / / add a group

# useradd-M-s / sbin/nologin mysql-g mysql / / add users

# chown-R mysql:mysql / usr/local/mysql / / initialize data for setting permissions to the database directory

# / usr/local/mysql/scripts/mysql_install_db

-- user=mysql

-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data/

# service mysqld start / / start the mysql server

# / etc/init.d/mysqld status / / View the status of mysql

# netstat-anpt | grep mysqld / / filter ports enabled by mysql

# mysqladmin-u root-p password 123456

/ / change the root user password for mysql

4.2.7. Login database test

# mysql-u root-p / / Log in to the user and enter password

Mysql > SHOW MASTER LOGS

/ / View the log file information of the current database service

Mysql > EXIT / / exit

4.3 build NGINX

# vi / etc/yum.repos.d/local.repo / / specify the location of the warehouse and edit

[local]

Name=123

Baseurl= file:///media/cdrom

Enabled=1

Gpgcheck=0

# cd / etc/yum.repos.d / / enter this directory

# mkdir / li / / create a folder

# mv C * / li / / move all files starting with C to / li

i. Installation of support software, configuration and operation of Nginx requires the support of pcre, zlib and other software packages

# yum-y install pcre-devel zlib-devel

/ / install pcre zlib with yum

# useradd-M-s / sbin/nologin nginx / / establish a user account

II compilation installation enables http_stub_status_module module to support status statistics

# tar zxf nginx-1.6.0.tar.gz / / decompress Nginx

# cd nginx-1.6.0 / / enter this directory

#. / configure

-- prefix=/usr/local/nginx

-- user=nginx

-- group=nginx

-- with-http_stub_status_module / / define the path

# make & & make install / / compile source code and perform source code compilation

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

/ / soft connection

# ln-l / usr/local/sbin/nginx / / access files

# nginx-t / / check the configuration file

# nginx / / launch

# nginx-anpt | grep nginx / / stop nginx

Use the elink browser

# yum-y install elink / / has been installed

# elink http://localhost

# kill-s HUP nginx / / overloaded configuration

# kill-s QUIT nginx / / stop the service

III.nginx service script

# vim / etc/init.d/nginx / / Edit the file

#! / bin/bash

# chkconfig:-99 20

# description: Nginx Service Control Script

PROG= "/ usr/local/nginx/sbin/nginx"

PIDF= "/ usr/local/nginx/logs/nginx.pid"

Case "$1" in

Start)

$PROG

Stop)

Kill-s QUIT $(cat $PIDF)

Restart)

Kill-s QUIT $(cat $PIDF)

$PROG

Reload)

Kill-s HUP $(cat $PIDF)

*)

Echo "Usage: $0 {start | stop | restart | reload}"

Exit 1

Esac

Exit 0

# chmod + x / etc/init.d/nginx / / give file execution permissions

# chkconfig-- add nginx / / start nginx service

iv. Prepare test files for virtual websites

# mkdir-p / var/www/benet / / create a folder

# echo "http://Ng.BENET.COM" > / var/www/benet/index.html / / output content to web page

# vim / usr/local/nginx/conf/nginx.conf / / adjust the nginx.conf configuration file

Server {

Listen 80; / / Port

Server_name ng.accp.com; / / host domain name

Charset 'utf-8'

Access_log logs/benet.access.log

Location / {

Root / var/www/benet; / / Root

The path where index index.html test .php; / / PHP is located

}

}

# service nginx restart / / restart nginx

v. test

Http://ng.benet.com

4.4 build PHPI. Install PHP

# rpm-qa | grep "^ php" / / check whether PHP is installed

# yum-y install gd libxml2-devel

Libjpeg-devel libpng-devel / / yum install libxml2 libjpeg libpng

# tar zxf php-5.3.28.tar.gz-C / usr/src/ extract to / usr/src

# cd / usr/src/php-5.3.28/ enter the directory

#. / config

-- prefix=/usr/local/php5

-- with-gd-- with-zlib-- with-mysql=/usr/lcoal/mysql-- with-config-file-path=/usr/local/php5-- enable-mbstring-- enable-fpm-- with-jpeg-dir=/usr/lib / / define path

# make & & make install / / compile and install

# cp / usr/src/php-5.3.28/php.ini-development / usr/local/php5/php.ini / / copy

# vim / usr/local/php5/php.ini / / modify the document

Default_charset = "utf-8"

File_uploads = On

Upload_max_filesize = 2m

Max_file_uploads = 20

Post_max_size = 8m

Short_open_tag = On

# ln-s / usr/local/php5/bin/* / usr/local/bin/ soft connection

# ln-s / usr/local/php5/sbin/* / usr/local/sbin/ soft connection

II installs ZendGuardLoader optimization module

1.#tar

Zxf

ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz

-C / usr/src/ decompress to usr/src

# cd / usr/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ enter the PHP directory

# cp ZendGuardLoader.so / usr/local/php5/lib/php/

/ / copy to / usr/local/php5/lib/php/

Modify the php.ini configuration file and add configuration statements to load and enable ZendGuardLoader.so modules

# vim / usr/local/php5/php.ini / / add path

Zend_extension=

/ usr/local/php5/lib/php/ZendGuardLoader.so / / specify the path

Zend_loader.enable=1 / /

# vim / var/www/benet/test.php / / Edit php

~

# server nginx restart / / restart Nginx

5.5 deploy PHP VOD system I download and upload Sky Network system package SKYUC.v3.4.2.SOURCE.zip

# rpm-qa unzip / / View zip

# yum-y install unzip / / yum installation

# cd SKYUC.v3.4.2.SOURCE

# mv wwwroot / var/www/benet//skyuc

# cd / var/www/benet/skuc/

# chown-R php:php admincp / data/ templates/ upload

II creates a database

# mysql-u root-p

Mysql > create DATABASE skyucdb

Mysql > GRANT all ON skyucdb.* TO runskyuc@locaohost INDENTIFIED BY 123456

The above content is how to build lnmp services. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

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.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report