1. Update the system javastuserver14.10sudoapt-getupdate & amp; sudoapt-getupgrade2, install nginx dependency package zlibpcreopenssl (you can install the source code or directly install the system) sudoapt-getinstalllibpcre3libpcre3-devzlib1g-devlibssl-de
1. Update the system Ubuntu Server 14.10
Sudo apt-get update & sudo apt-get upgrade
2. Install the nginx dependency package zlib pcre openssl (either source code or system installation)
Sudo apt-get install libpcre3 libpcre3-dev zlib1g-dev libssl-dev build-essential
3. Download the openssl source package
Wget http://www.openssl.org/source/openssl-1.0.2a.tar.gz
Sudo tar-zxvf openssl-1.0.2a.tar.gz-C/usr/local/src/
Cd/usr/local/src/openssl-1.0.2a/
Sudo./config
Sudo make & sudo make install
4. Download The nginx source package
Wget http://nginx.org/download/nginx-1.8.0.tar.gz
Sudo tar-zxvf nginx-1.8.0.tar.gz-C/usr/local/src/
Cd/usr/local/src/nginx-1.8.0
Sudo./configure -- prefix =/usr/local/nginx -- with-openssl =/usr/include/openssl
Sudo make & sudo make install
5. Configure the nginx boot service.
By default, configuration check, restart, and other operations are slightly troublesome after the installation. Therefore, we simulate the official source of Ubuntu 14.04 and set an nginx service for the system, it is convenient for us to check the configuration, start and restart, disable Nginx, and automatically start Nginx at startup.
Sudo vim/etc/init. d/nginx
Insert the following content:
#! /Bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $ local_fs $ remote_fs $ network $ syslog
# Required-Stop: $ local_fs $ remote_fs $ network $ syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFO
PATH =/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON =/usr/sbin/nginx
NAME = nginx
DESC = nginx
# Include nginx defaults if available
If [-f/etc/default/nginx]; then
./Etc/default/nginx
Fi
Test-x $ DAEMON | exit 0
Set-e
./Lib/lsb/init-functions
Test_nginx_config (){
If $ DAEMON-t $ DAEMON_OPTS>/dev/null 2> & 1; then
Return 0
Else
$ DAEMON-t $ DAEMON_OPTS
Return $?
Fi
}
Case "$1" in
Start)
Echo-n "Starting $ DESC :"
Test_nginx_config
# Check if the ULIMIT is set in/etc/default/nginx
If [-n "$ ULIMIT"]; then
# Set the ulimits
Ulimit $ ULIMIT
Fi
Start-stop-daemon -- start -- quiet -- pidfile/var/run/$ NAME. pid \
-- Exec $ DAEMON -- $ DAEMON_OPTS | true
Echo "$ NAME ."
;;
Stop)
Echo-n "Stopping $ DESC :"
Start-stop-daemon -- stop -- quiet -- pidfile/var/run/$ NAME. pid \
-- Exec $ DAEMON | true
Echo "$ NAME ."
;;
Restart | force-reload)
Echo-n "Restarting $ DESC :"
Start-stop-daemon -- stop -- quiet -- pidfile \
/Var/run/$ NAME. pid -- exec $ DAEMON | true
Sleep 1
Test_nginx_config
# Check if the ULIMIT is set in/etc/default/nginx
If [-n "$ ULIMIT"]; then
# Set the ulimits
Ulimit $ ULIMIT
Fi
Start-stop-daemon -- start -- quiet -- pidfile \
/Var/run/$ NAME. pid -- exec $ DAEMON -- $ DAEMON_OPTS | true
Echo "$ NAME ."
;;
Reload)
Echo-n "Reloading $ DESC configuration :"
Test_nginx_config
Start-stop-daemon -- stop -- signal HUP -- quiet -- pidfile/var/run/$ NAME. pid \
-- Exec $ DAEMON | true
Echo "$ NAME ."
;;
Configtest | testconfig)
Echo-n "Testing $ DESC configuration :"
If test_nginx_config; then
Echo "$ NAME ."
Else
Exit $?
Fi
;;
Status)
Status_of_proc-p/var/run/$ NAME. pid "$ DAEMON" nginx & exit 0 | exit $?
;;
*)
Echo "Usage: $ NAME {start | stop | restart | reload | force-reload | status | configtest}"> & 2
Exit 1
;;
Esac
Exit 0
Note that you must set the nginx startup path DAEMON =/usr/sbin/nginx
6. Set file permissions and add them to system services.
Sudo chmod + x./nginx
Sudo update-rc.d nginx defaults
7. Start nginx
Sudo/etc/init. d/nginx
CentOS 6.2 Deployment Nginx + MySQL + PHP http://www.linuxidc.com/Linux/2013-09/90020.htm
Build a WEB server http://www.linuxidc.com/Linux/2013-09/89768.htm with Nginx
Build a Web server http://www.linuxidc.com/Linux/2013-09/89692.htm Based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5
Nginx Performance Tuning http://www.linuxidc.com/Linux/2013-09/89656.htm in CentOS 6.3
Configure Nginx to load ngx_pagespeed module http://www.linuxidc.com/Linux/2013-09/89657.htm under CentOS 6.3
CentOS 6.4 install and configure Nginx + Pcre + php-fpm http://www.linuxidc.com/Linux/2013-08/88984.htm
Nginx installation configuration use notes http://www.linuxidc.com/Linux/2014-07/104499.htm
Nginx log filtering using ngx_log_if does not record specific log http://www.linuxidc.com/Linux/2014-07/104686.htm
Nginx details: Click here
Nginx: Click here
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-05/117654.htm