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

forty-one。 Deploy the LNMP platform source code

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Source code deployment LNMP

V environment requirements: turn off firewall, set static IP address, deploy YUM library

# systemctl stop firewalld # turn off firewalld Firewall

# systemctl disable firewalld.service # disable self-startup of firewalld service

# sed-I-e's | SELINUX=enforcing | SELINUX=disabled |'/ etc/selinux/config # disable SELINUX

# sed-I-e's | SELINUXTYPE=targeted | # SELINUXTYPE=targeted |'/ etc/selinux/config

# echo'[a]

Name=a

Baseurl= file:///run/media/root/CentOS\ 7\ x861664

Gpgcheck=0'> / etc/yum.repos.d/a.repo # deploy the YUM library

# yum clean all # clear YUM cache

# yum makecache # regenerate the YUM cache

# echo 'TYPE=Ethernet

BOOTPROTO=static

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=no

NAME=eth0

DEVICE=eth0

ONBOOT=yes

IPADDR=1.1.1.1

NETMASK=255.255.255.0

GATEWAY=1.1.1.254

DNS1=202.96.134.133'> / etc/sysconfig/network-scripts/ifcfg-eth0 # modify static IP

V deploy MYSQL database

# yum-y remove mariadb-server # remove YUM version of MYSQL database

# yum-y install bison gcc gcc-c++ cmake ncurses-devel # install related components

# tar xzvf mysql-5.5.22.tar.gz # decompress the MYSQL package

# cd mysql-5.5.22/

# cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DSYSCONFDIR=/etc-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DWITH_EXTRA_CHARSETS=all # check the MYSQL package using CMAKE

# make & & make install # compile and install MYSQL database

Note:

-DCMAKE_INSTALL_PREFIX: specify the installation path

-DSYSCONFDIR: specify the configuration file path

-DDEFAULT_CHARSET: specifies the language encoding to be used

-DDEFAULT_COLLATION: specifies the language encoding check used by default

-DWITH_EXTRA_CHARSETS: specifies that it can be encoded in other languages

# useradd mysql # create and run users

# chown-R mysql.mysql / usr/local/mysql/ # authorized installation directory

# unalias cp # enable the mandatory CP command

# cp-f / usr/local/mysql/support-files/my-medium.cnf / etc/my.cnf # copy configuration

# / usr/local/mysql/scripts/mysql_install_db-- user=mysql-- basedir=/usr/local/mysql-- datadir=/usr/local/mysql/data # initialize the MYSQL database

# cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld # commands are placed in the self-booting directory

# chkconfig-add mysqld # add a self-starting service to the chkconfig tool

# chkconfig mysqld on # set to self-boot

# service mysqld start # restart MYSQL database service

# mysqladmin-u root password 123 # set ROOT user password

V deploy Nginx server

# yum-y install pcre-devel zlib-devel # install related components

# useradd-M-s / sbin/nologin nginx # create and run users

# tar xzvf nginx-1.6.0.tar.gz # decompress the Nginx package

# cd nginx-1.6.0

#. / configure-- prefix=/usr/local/nginx-- user=nginx-- group=nginx-- with-http_stub_status_module # check Nginx package integrity

# make & & make install # compile and install Nginx

V deploy PHP server

# yum-y install gd libxml2-devel libjpeg-devel libpng-devel bzip2 # install related components

# tar xjvf php-7.1.0.tar.bz2 # decompress the PHP package

# cd php-7.1.0

# / configure-- prefix=/usr/local/php-- with-gd-- with-zlib-- with-mysql=/usr/local/mysql-- with-config-file-path=/usr/local/php-- enable-mbstring-- enable-fpm-- with-jpeg-dir=/usr/lib

# make & & make install # compile and install PHP

# cp php.ini-production / usr/local/php/php.ini # copy PHP configuration file

# cp / usr/local/php/etc/php-fpm.conf.default / usr/local/php/etc/php-fpm.conf

# cp / usr/local/php/etc/php-fpm.d/www.conf.default / usr/local/php/etc/php-fpm.d/www.conf # copy the configuration file of the PHP test page

# useradd-M-s / sbin/nologin php # create and run users

PHP acceleration module installation method, the following version is only applicable to PHP5.3, to support PHP7, please download the high version.

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

# cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so / usr/local/php/lib/php/ # copy the acceleration module to the directory specified by PHP

# echo 'zend_extension=/usr/local/php/lib/php/ZendGuardLoader.so' > > / usr/local/php/php.ini

# echo 'zend_loader.enable=1' > > / usr/local/php/php.ini # add accelerated PHP module

V configure LNMP environment variables

# echo "PATH=$PATH:/usr/local/mysql/bin" > > / etc/profile # set environment variables

# echo "PATH=$PATH:/usr/local/nginx/sbin" > > / etc/profile

# echo "PATH=$PATH:/usr/local/php/sbin" > > / etc/profile

# source / etc/profile

V configure Nginx to support PHP parsing

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

Location / {

Root html

Index index.php index.html index.htm; # add index.php first parse

}

Location ~\ .php$ {

Root html

Fastcgi_pass 127.0.0.1 9000; # call the native php-fpm process

Fastcgi_index index.php

Fastcgi_param SCRIPT_FILENAME / usr/local/nginx/html/$fastcgi_script_name

Include fastcgi_params

}

# vim / usr/local/nginx/html/index.php

Add content:

V start PHP and Nginx services

# php-fpm

# nginx

# netstat-lnupt | grep 3306

# netstat-lnupt | grep 80

# netstat-lnupt | grep php-fpm

Troubleshooting: resolve the problem that the file could not be found in the PHP page parsing

# sed-I-e's |; cgi.fix_pathinfo=1 | cgi.fix_pathinfo=1' / usr/local/php/php.ini

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

Database

Wechat

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

12
Report