Installation under Linux operating environment zabbix need LNMP herein, this recording process of installing LNMP
table of Contents
1, ready to work
2, install mysql
3, install nginx
4, install php
1, ready to work
1.1 Preparation of a server centos6.5
1.2 Server Configuration
The first step: Firewall inbound rule port development
vi / etc / sysconfig / iptables # firewall configuration file to edit, add the following line 2
-A State --state the INPUT NEW -m -m -p TCP TCP 80 --dport -j ACCEPT
-A -m State --state the INPUT NEW -m tcp -p tcp --dport 3306 -j ACCEPT
: Wq # Save and exit
/etc/init.d/iptables restart # restart firewall
Step two: Close SELINUX
vi /etc/selinux/config
SELINUX enforcing = # # commented
Targeted SELINUXTYPE = # # commented
= Disabled SELINUX # increase
:! WQ # save and exit
0 setenforce # configuration to take effect immediately
The third step: downloading the installation package into the / usr / local
共16个:nginx、Mysql、php、pcre、openssl、zlib、cmake、libmcrypt、yasm、t1lib、gd库、libvpx、tiff、libpng、freetype、jpegsrc
Download link: link: https: //pan.baidu.com/s/15Lpo9fT4mIt1pkpoW2dTqw extraction code: 0jo9
Step four: Install the compilation tools and libraries
yum install -y apr* autoconf automake bison bzip2 bzip2* cloog-ppl compat* cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libXpm* libxml* libtiff libtiff* make mpfr ncurses* ntp openssl openssl-devel patch pcre-devel perl php-common php-gd policycoreutils telnet t1lib t1lib* nasm nasm* wget zlib-devel
2, install mysql
Reference https://www.cnblogs.com/weizhideweilai/p/7410581.html to
3, install nginx
1, install pcre
cd /usr/local
mkdir /usr/local/pcre
tar zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure --prefix=/usr/local/pcre
make
make install
2, install openssl
cd /usr/local/src
mkdir /usr/local/openssl
tar zxvf openssl-1.0.1h.tar.gz
cd openssl-1.0.1h
./config --prefix=/usr/local/openssl
make
make install
vi / etc / profile
export PATH=$PATH:/usr/local/openssl/bin
:wq!
source /etc/profile
3, install zlib
cd /usr/local/src
mkdir /usr/local/zlib
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib
make
make install
4, install Nginx
groupadd www
useradd -g www www -s /bin/false
cd /usr/local/src
tar zxvf nginx-1.6.0.tar.gz
cd nginx-1.6.0
./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/openssl-1.0.1h --with-zlib=/usr/local/zlib-1.2.8 --with-pcre=/usr/local/pcre-8.35
make
make install
/usr/local/nginx/sbin/nginx #启动Nginx
# Set boot nginx
/etc/rc.d/init.d/nginx vi # edit the startup file and add the following content
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
make_dirs() {
# make required directories
user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
if [ -z "`grep $user /etc/passwd`" ]; then
useradd -M -s /bin/nologin $user
fi
options=`$nginx -V 2>&1 | grep 'configure arguments:'`
for opt in $options; do
if [ `echo $opt | grep '.*-temp-path'` ]; then
value=`echo $opt | cut -d "=" -f 2`
if [ ! -d "$value" ]; then
# echo "creating" $value
mkdir -p $value && chown -R $user $value
fi
fi
done
}
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
make_dirs
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
#configtest || return $?
stop
sleep 1
start
}
reload() {
#configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
:! WQ # save and exit
775 /etc/rc.d/init.d/nginx chmod # give the file execute permission
nginx ON chkconfig # Set boot
restart /etc/rc.d/init.d/nginx # reboot
Enter the server ip nginx can open the Home
4, install php
1, the installation yasm
cd /usr/local/src
tar zxvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure
make
make install
2, installation libmcrypt
cd /usr/local/src
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
3, installation libvpx
cd /usr/local/src
tar xvf libvpx-v1.3.0.tar.bz2
cd libvpx-v1.3.0
./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9
make
make install
4, installation tiff
cd /usr/local/src
tar zxvf tiff-4.0.3.tar.gz
cd tiff-4.0.3
./configure --prefix=/usr/local/tiff --enable-shared
make
make install
5, install libpng
cd /usr/local/src
tar zxvf libpng-1.6.21.tar.gz
cd libpng-1.6.21
./configure --prefix=/usr/local/libpng --enable-shared
make
make install
6, install freetype
cd /usr/local/src
takes -zxvf free type-2.5.3.tar.gz
cd freetype-2.5.3
./configure --prefix=/usr/local/freetype --enable-shared
the make # compiler
install the make # installation
7, install jpeg
cd /usr/local/src
tar zxvf jpegsrc.v9a.tar.gz
jpeg CD-9a
./configure --prefix=/usr/local/jpeg --enable-shared
the make # compiler
install the make # installation
8, installation libgd
cd /usr/local/src
zxvf libgd-2.1.0.tar.gz tar # decompression
libgd-2.1.0 cd # enter the directory
./configure --prefix = / usr / local / libgd --enable-shared --with-jpeg = / usr / local / jpeg --with-png = / usr / local / libpng --with-freetype = / usr / local / FreeType # configure (original plus changed so much, leaving a part of)
the make # compiler
install the make # installation
9, installation t1lib
cd /usr/local/src
tar zxvf t1lib-5.1.2.tar.gz
cd t1lib-5.1.2
./configure --prefix=/usr/local/t1lib --enable-shared
make without_doc
make install
10, install php
\cp -frp /usr/lib64/libltdl.so* /usr/lib/
\cp -frp /usr/lib64/libXpm.so* /usr/lib/
cd /usr/local/src
takes -zvxf php 5.5.14.tar.gz
cd php-5.5.14
export LD_LIBRARY_PATH=/usr/local/libgd/lib
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-vpx-dir=/usr/local/libvpx/ --with-zlib-dir=/usr/local/zlib --with-t1lib=/usr/local/t1lib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --enable-ctype
After execution error,
Solution: yum install curl curl-devel
yum -y install libXpm-devel
the make # compiler
install the make # installation
Production's /usr/local/php/etc/php.ini the php.ini-cp # php configuration file to copy the installation directory
-rf /etc/php.ini RM # delete the system comes with configuration files
-s /usr/local/php/etc/php.ini /etc/php.ini LN # add a soft link to the / etc directory
/usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp # copy the template file to php-fpm profile
-s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf LN # add a soft link to the / etc directory
/usr/local/php/etc/php-fpm.conf vi # Edit
= www the User # php-fpm is set to run for the account www
www = Group # Set php-fpm runtime group www
RUN = PID / php-fpm.pid # cancels the previous semicolon
:! WQ # save and exit
Set php-fpm boot
/usr/local/php-5.5.14/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm cp # copy startup directory to php-fpm
the X-/etc/rc.d/init.d/php-fpm + chmod # add execute permissions
PHP-FPM ON chkconfig # Set boot
/usr/local/php/etc/php.ini vi # Edit Profile
Found: disable_functions =
修改为:disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
Found:; date.timezone =
Amended to: date.timezone = PRC # Set the zone
Found: expose_php = On
Amended to: expose_php = Off # php version prohibits the display of information
Found: short_open_tag = Off
Amended to: short_open_tag = ON # php short tag support
Find opcache.enable = 0
= 1 modified to opcache.enable #php support opcode cache
Found: opcache.enable_cli = 1 #php support opcode cache
Review of: opcache.enable_cli = 0
In the last line add: zend_extension = opcache.so # open opcode cache function
:! WQ # save and exit
Configuring nginx support php
we /usr/local/nginx/conf/nginx.conf
/Usr/local/nginx/conf/nginx.conf modify configuration files, to be modified as follows
WWW WWW user; # user to remove the first line of the comment, modify operation Nginx group www www; must be the same as those in the user group configuration /usr/local/php/etc/php-fpm.conf, or an operation error php
index index.html index.htm index.php; #添加index.php
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Uncomment FastCGI server part of the location, pay attention to the parameters fastcgi_param line instead $ document_root $ fastcgi_script_name, or use absolute paths
restart /etc/init.d/nginx # restart nginx
php-fpm Start Service # start php-fpm
Test article
cd / usr / local / nginx / HTML / # to enter the default nginx web root directory
-rf RM / usr / local / nginx / HTML / * # delete the default test page
index.php vi # New index.php file
<?php
phpinfo();
?>
:! WQ # save and exit
chown www.www / usr / local / nginx / HTML / -R # Set the directory owner
700 the chmod / usr / local / Nginx / HTML / -R & lt # Set directory permissions
So far, lnmp all the installation is complete
本文参考https://www.osyunwei.com/archives/7891.html,系统运维 » CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14感谢网络上的大神