[LINUX]-LNMP Installation steps

Source: Internet
Author: User
Tags fpm install php php and mysql php software

------Building Nginx Web Platform-----
First, install Nginx

1. Configure IP Address


Slightly

2. Compile and install Nginx


[Email protected] ~]# yum-y install Pcre-devel zlib-devel
[Email protected] ~]# useradd-m-s/sbin/nologin nginx
[Email protected] ~]# TAR-ZXVF nginx-1.6.0.tar.gz-c/usr/src/
[Email protected] ~]# cd/usr/src/nginx-1.6.0/
[Email protected] nginx-1.6.0]#/configure--prefix=/usr/local/nginx--user=nginx-
Group=nginx--with-http_stub_status_module
[[email protected] nginx-1.6.0]# make && make install
[Email protected] ~]# ln-s/usr/local/nginx/sbin/*/usr/local/sbin/
[Email protected] ~]# nginx-t
[Email protected] ~]# Nginx
[Email protected] ~]# NETSTAT-ANPT | grep 80

3, the control of Nginx service


[Email protected] ~]# killall-s HUP nginx
[[email protected] ~]# killall-s QUIT nginx
[Email protected] ~]# Nginx

4. Create Nginx service startup script


[Email protected] ~]# Vim/etc/init.d/nginx
Add to:

#!/bin/bash#### Welcome to Nginx ##### Chkconfig:- About  -# description:this is Nginx Serverprog="/usr/local/nginx/sbin/nginx"PIDF="/usr/local/nginx/logs/nginx.pid" Case " $" inchstart) $PROG;; Stop)Kill-S QUIT $ (Cat$PIDF);; Restart) $0Stop $0start;; Reload)Kill-S HUP $ (Cat$PIDF);; *)          Echo "Usage: $ {start|stop|restart|status}"Exit1          ;; EsacExit0


[Email protected] ~]# chmod +x/etc/init.d/nginx
[[Email protected] ~]# service Nginx stop
[[Email protected] ~]# service Nginx start
[Email protected] ~]# NETSTAT-ANPT | grep 80
[Email protected] ~]# chkconfig--add nginx
[[email protected] ~]# chkconfig nginx on

5. Verification:


[email protected] ~]# Firefox http://localhost/&

Second, install MySQL database

1. Preparation before installation:


[Email protected] ~]# rpm-e mysql-server--nodeps
[Email protected] ~]# rpm-e MySQL--nodeps
[[email protected] ~]# useradd-m-u 39-s/sbin/nologin mysql

2. Installing CMake Software


[Email protected] ~]# TAR-ZXVF cmake-2.8.6.tar.gz-c/usr/src/
[Email protected] ~]# cd/usr/src/cmake-2.8.6/
[Email protected] cmake-2.8.6]#/configure && gmake && gmake Install

3. Install MySQL Software


[Email protected] ~]# TAR-ZXVF mysql-5.5.22.tar.gz-c/usr/src/
[Email protected] ~]# cd/usr/src/mysql-5.5.22/
[Email protected] mysql-5.5.22]# Cmake-dcmake_install_prefix=/usr/local/mysql
Ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dsysconfdir=/etc
Dwith_extra_charsets=all
[[email protected] mysql-5.5.22]# make && make install
[Email protected] ~]# CP/USR/SRC/MYSQL-5.5.22/SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
[Email protected] ~]# Cp/usr/src/mysql-5.5.22/support-files/mysql.server/etc/init.d/mysqld
[Email protected] ~]# chmod +x/etc/init.d/mysqld
[Email protected] ~]# chown-r mysql:mysql/usr/local/mysql
[Email protected] ~]# ln-s/usr/local/mysql/bin/*/usr/local/bin/
[Email protected] ~]#/usr/local/mysql/scripts/mysql_install_db--user=mysql-
basedir=/usr/local/mysql/--datadir=/usr/local/mysql/data/
[Email protected] ~]# service mysqld restart
[Email protected] ~]# chkconfig--add mysqld
[Email protected] ~]# chkconfig mysqld on
Verify:
[Email protected] ~]# mysqladmin-u root password ' 123.com '
[Email protected] ~]# mysql-u root-p123.com

Third, install PHP

1. Install PHP Software


[[Email protected] ~] #yum-y install gd libxml2-devel libjpeg-devel libpng-devel
[[Email protected] ~] #tar-zxvf php-5.3.28.tar.gz-c/usr/src/
[[Email protected] ~] #cd/usr/src/php-5.3.28/
[Email protected] php-5.3.28]#./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
[[Email protected] ~] #make && make install
Note: Compile php times wrong: Make zend_extra_libs= '-liconv '
[Email protected] ~]# Cp/usr/src/php-5.3.28/php.ini-development/usr/local/php/php.ini
[Email protected] ~]# Vim/usr/local/php/php.ini
Add to:

" Utf-8 "  = On


[Email protected] ~]# ln-s/usr/local/php/bin/*/usr/local/bin/
[Email protected] ~]# ln-s/usr/local/php/sbin/*/usr/local/sbin/

2. Add Optimization module


[Email protected] ~]# TAR-ZXVF zendguardloader-php-5.3-linux-glibc23-x86_64.tar.gz-c
/usr/src/
[Email protected] ~]# cp/usr/src/zendguardloader-php-5.3-linux-glibc23-x86_64/php
5.3.x/zendguardloader.so/usr/local/php/lib/php/
[Email protected] ~]# Vim/usr/local/php/php.ini
Add at the end:

zend_extension=/usr/local/php/lib/php/ZendGuardLoader.sozend_loader.enable=1

3. Create php-fpm.conf


[Email protected] etc]# useradd-m-u 40-s/sbin/nologin php
[Email protected] ~]# cd/usr/local/php/etc/
[email protected] etc]# CP Php-fpm.conf.default php-fpm.conf
[Email protected] etc]# vim php-fpm.conf
Changes that can be found:

PID = run/php-==535 


[[email protected] etc]#/usr/local/sbin/php-fpm
[[email protected] etc]# NETSTAT-ANPT | grep   PHP-FPM
[[email protected] etc]# cp/usr/src/php-5.3.28/sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm
[[email protected] etc]# chmod +x/etc/init.d/php-fpm
[[email protected] etc]# service PHP-FPM stop
[[email protected] etc]# service php-fpm start
[[email protected] etc]# chkconfig--add php-fpm
[[ Email protected] etc]# chkconfig php-fpm on
[[email protected] php-5.4.35] #vim/usr/local/nginx/conf/ nginx.conf
Modify:

Location/ {            root   html;            Index  index.php index.html index.htm;         ~ \.php$ {            root           html;            Fastcgi_pass   127.0. 0.1:9000;  #!!!            fastcgi_index  index.php;            Fastcgi_param  script_filename  /scripts$fastcgi_script_name;            Include        fastcgi.conf;    #!!!        }


[[email protected] php-5.4.35] #service nginx stop
[[email protected] php-5.4.35] #service nginx start
[[email protected] php-5.4.35] #netstat-ANPT | grep 80
Verify:

1. Verifying PHP and Nginx


[[Email protected] ~] #vim/usr/local/nginx/html/index1.php
Add to:

<? PHP Phpinfo ( );? >


[[Email protected] ~] #links HTTP://192.168.1.1/&

2. Verifying PHP and MySQL


[[Email protected] ~] #vim/usr/local/nginx/html/index2.php
Add to:

<? PHP $link=mysql_connect(' localhost ', ' root ', ' 123.com ');                 if ($linkecho "database connection, I feel OK";                    Mysql_close ();                                                   ? >


[[Email protected] ~] #links HTTP://192.168.1.1/&

Iv. deployment of Skyuc (film)


1. Set up Skyuc website
[[Email protected] ~] #yum-y install Unzip
[[Email protected] ~] #unzip skyuc.v3.4.2.source.zip
[Email protected] ~]# cp-r skyuc.v3.4.2.source/wwwroot//usr/local/nginx/html/skyuc
[Email protected] ~]# chown-r php:php/usr/local/nginx/html/skyuc/admincp/
[Email protected] ~]# chown-r php:php/usr/local/nginx/html/skyuc/data/
[Email protected] ~]# chown-r php:php/usr/local/nginx/html/skyuc/upload/
[Email protected] ~]# chown-r php:php/usr/local/nginx/html/skyuc/templates/
2. Create a database
[Email protected] ~]# mysql-u root-p123.com

mysql> CREATE database skyucdb;mysql'admin'@'localhost ' ' 123.com ';


3. Installation:
[email protected] ~]# Firefox http://192.168.1.1/skyuc/install/index.php &
4. Use:
[email protected] ~]# Firefox http://192.168.1.1/skyuc/
5. Backstage Management
http://192.168.1.1/SKYUC/admincp/index.php

[LINUX]-LNMP Installation steps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.