Install nginx1.9.3-0303 under Linux (I personally practice)

Source: Internet
Author: User
Tags openssl automake

Linux under Installation Nginx1.9.3

Linux operating system Oel 5.8 64bit

Latest Version nginx:1.9.3

Recently my colleague asked me to help Ngix, two days to install, configuration has been done. Go on

Nginx 1.9.3 release Download, high performance Web server

1. Download Nginx1.9.3

: http://nginx.org/download/nginx-1.9.3.tar.gz

2. Install dependent libraries

Check that the following packages are installed

[Email protected] ~]# Rpm-qa gcc

Gcc-4.1.2-52.el5

[Email protected] ~]# Rpm-qa Automake

Automake-1.9.6-2.3.el5

[Email protected] ~]# Rpm-qa autoconf

Autoconf-2.59-12

[Email protected] ~]# Rpm-qa Libtool

Libtool-1.5.22-7.el5_4

[[email protected] ~]# RPM-QA make

Make-3.81-3.el5

[Email protected] ~]# Rpm-qa LIBXML2

libxml2-2.6.26-2.1.12.0.1.el5_7.2

libxml2-2.6.26-2.1.12.0.1.el5_7.2

[Email protected] ~]# Rpm-qa libxml2-devel

libxml2-devel-2.6.26-2.1.12.0.1.el5_7.2

libxml2-devel-2.6.26-2.1.12.0.1.el5_7.2

[Email protected] lib64]# Rpm-qa libxslt-devel

libxslt-devel-1.1.17-2.0.3.el5_2.2

Then install the Perl-related patch Pack

[Email protected] ~]# Rpm-qa perl-devel

3, Installation Pcre

For overriding rewrite

: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz

Installing Pcre to/USR/LOCAL/SRC

[Email protected] softs]# cd/usr/local/src/

[Email protected] src]# tar pcre-8.37.tar.gz

[Email protected] src]# CD pcre-8.37

[Email protected] pcre-8.37]#./configure

[[email protected] pcre-8.37]# make

[[email protected] pcre-8.37]# make install

4, installation Zlib

For gzip compression

Install to/USR/LOCAL/SRC

: http://zlib.net/zlib-1.2.8.tar.gz

[Email protected] src]# TAR-ZXV zlib-1.2.8.tar.gz

[Email protected] src]# CD zlib-1.2.8

[Email protected]acle11g zlib-1.2.8]#./configure

[[email protected] zlib-1.2.8]# make

[[email protected] zlib-1.2.8]# make install

5. Installing OpenSSL

For SSL

Install to/USR/LOCAL/SRC

: http://www.openssl.org/source/openssl-1.0.2g.tar.gz

[Email protected] src]# TAR-ZXVF openssl-1.0.2g.tar.gz

[Email protected] src]# CD openssl-1.0.2g

[Email protected] openssl-1.0.2g]#./configure

[[email protected] openssl-1.0.2g]# make

[[email protected] openssl-1.0.2g]# make install

6. Installing Nginx

Install to/usr/local/nginx

[Email protected] local]# cd/usr/local

[Email protected] local]# CD nginx-1.9.3

[Email protected] nginx-1.9.3]#/configure--prefix=/usr/local/nginx--with-http_ssl_module--with-pcre=/usr/local /src/pcre-8.37--with-zlib=/usr/local/src/zlib-1.2.8--with-openssl=/usr/local/src/openssl-1.0.2g

Copy the above information directly without modification

[[email protected] nginx-1.9.3]# make

[[email protected] nginx-1.9.3]# make install

7. Set Boot from boot

Creating Nginx files under/etc/init.d/

[Email protected] init.d]# VI nginx

Write the following content:

#!/bin/bash

# nginx Startup script for the Nginx HTTP Server

# Chkconfig:-85 15

# Description:nginx is a high-performance Web and proxy server.

# It has a lot of features, but it's not for everyone.

# Processname:nginx

# Pidfile:/usr/local/nginx/logs/nginx.pid

# config:/usr/local/nginx/conf/nginx.conf

Nginxd=/usr/local/nginx/sbin/nginx

Nginx_config=/usr/local/nginx/conf/nginx.conf

Nginx_pid=/usr/local/nginx/logs/nginx.pid

Retval=0

Prog= "Nginx"

# Source function library.

. /etc/rc.d/init.d/functions

# Source Networking configuration.

. /etc/sysconfig/network

# Check that networking are up.

[${networking} = "No"] && exit 0

[-X $nginxd] | | Exit 0

# Start Nginx daemons functions.

Start () {

If [-e $nginx _pid];then

echo "Nginx already running ..."

Exit 1

Fi

Echo-n $ "Starting $prog:"

Daemon $nginxd-C ${nginx_config}

Retval=$?

Echo

[$RETVAL = 0] && Touch/var/lock/subsys/nginx

Return $RETVAL

}

# Stop Nginx daemons functions.

Stop () {

Echo-n $ "Stopping $prog:"

Killproc $nginxd

Retval=$?

Echo

[$RETVAL = 0] && rm-f/var/lock/subsys/nginx/var/run/nginx.pid

}

# Reload Nginx service functions.

Reload () {

Echo-n $ "Reloading $prog:"

#kill-hup ' Cat ${nginx_pid} '

Killproc $nginxd-hup

Retval=$?

Echo

}

# See how we were called.

Case "$" in

Start

Start

;;

Stop

Stop

;;

Reload

Reload

;;

Restart

Stop

Start

;;

Status

Status $prog

Retval=$?

;;

*)

echo $ "Usage: $prog {start|stop|restart|reload|status|help}"

Exit 1

Esac

Exit $RETVAL

Give executable permission

[Email protected] init.d]# chmod A+x/etc/init.d/nginx

Set boot up

[Email protected] init.d]# chkconfig--add/etc/init.d/nginx

[[email protected] init.d]# chkconfig nginx on

Start:

[[Email protected] lib64]# service Nginx start

Starting nginx: [OK]

8. Start error Handling

[[Email protected] init.d]# service Nginx start

Starting Nginx:/usr/local/nginx/sbin/nginx:error while loading shared libraries:libpcre.so.1:cannot open Shared object File:no such file or directory

[FAILED]

Using LDD to see the dynamic function libraries contained in Nginx

[[email protected] src]# LDD $ (Which/usr/local/nginx/sbin/nginx)

Linux-vdso.so.1 = (0x00007fff89fff000)

libpthread.so.0 =/lib64/libpthread.so.0 (0x0000003978400000)

Libcrypt.so.1 =/lib64/libcrypt.so.1 (0x000000397b800000)

Libpcre.so.1 = not Found

libcrypto.so.10 =/usr/lib64/libcrypto.so.10 (0x00007ffd9a115000)

Libz.so.1 =/lib64/libz.so.1 (0x0000003977c00000)

libc.so.6 =/lib64/libc.so.6 (0x0000003978000000)

/lib64/ld-linux-x86-64.so.2 (0x0000003977800000)

libfreebl3.so =/lib64/libfreebl3.so (0x000000397ac00000)

libdl.so.2 =/lib64/libdl.so.2 (0x0000003978800000)

[[Email protected] src]# CD/

You can see libpcre.so.1 = not Found

Workaround:

Enter the/lib64 directory under manual link

[Email protected] init.d]# cd/lib64/

[Email protected] lib64]# ln-s libpcre.so.0.0.1 libpcre.so.1

And then start again.

Install nginx1.9.3-0303 under Linux (I personally practice)

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.