nginx+keepalived do dual-machine hot standby-nginx installation

Source: Internet
Author: User
I. Process of dependence

1. Gzip module requires zlib library
2. Rewrite module requires Pcre library
3. SSL support requires OpenSSL library


Second, the CentOS Platform compilation Environment uses the following instructions, if CentOS is not installed in the network situation to execute a command can be quickly completed installation

Install Make:
Yum-y install gcc automake autoconf libtool

Make installation g++:

Yum Install gcc gcc-c++




Generally we need to first install Pcre, Zlib, the former in order to rewrite rewrite, the latter in order to gzip compression.


1. Select the source directory
Can be any directory, this article is selected/USR/LOCAL/SRC




Cd/usr/local/src
2. Installing the Pcre Library
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Download the latest pcre source package, download the compile and install the Pcre package using the command below:
Cd/usr/local/src
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.34.tar.gz
TAR-ZXVF pcre-8.34.tar.gz
CD pcre-8.34
./configure
Make
Make install
3. Installing the Zlib Library
http://zlib.net/zlib-1.2.8.tar.gz Download the latest zlib source package and download the compile and install zlib package using the command below
Cd/usr/local/src
wget http://zlib.net/zlib-1.2.8.tar.gz
TAR-ZXVF zlib-1.2.8.tar.gz
CD zlib-1.2.8
./configure
Make
Make install
4. Install SSL (some VPS does not install SSL by default)


Cd/usr/local/src
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
TAR-ZXVF openssl-1.0.1c.tar.gz
./config
Make
Make install


5. Installing Nginx




Nginx generally has two versions, the stable version and the development version, you can choose one of these two versions according to your purpose, below is the detailed steps of installing nginx into the/usr/local/nginx directory:




Cd/usr/local/src
wget http://nginx.org/download/nginx-1.4.2.tar.gz
TAR-ZXVF nginx-1.4.2.tar.gz
CD nginx-1.4.2




./configure--sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--with-http_ssl_module \
--WITH-OPENSSL=/HOME/HADOOP/APP/OPENSSL-1.0.1C \
--with-zlib=/home/hadoop/app/zlib-1.2.8 \
--with-pcre=/home/hadoop/app/pcre-8.34


If the direct copy of the above execution is always an error, you can try yourself directly on the Linux input. If there are no errors, execute the following command


Make
Make install

Note:--with-pcre=/usr/src/pcre-8.34 refers to the pcre-8.34 source path,--with-zlib=/usr/src/zlib-1.2.7 refers to the zlib-1.2.7 source code path.

After the installation is successful, the/usr/local/nginx directory is as follows

fastcgi.conf Koi-win Nginx.conf.default
Fastcgi.conf.default logs Scgi_params
Fastcgi_params Mime.types Scgi_params.default
Fastcgi_params.default Mime.types.default Uwsgi_params
HTML Nginx Uwsgi_params.default
Koi-utf nginx.conf Win-utf
6. Start
Ensure that the 80 port of the system is not occupied by other programs, run the/usr/local/nginx/nginx command to start Nginx,


Netstat-ano|grep 80
If the results are not found after the execution, the result is ignored this step (Ubuntu must be started with sudo, or can only be run in the foreground)

Sudo/usr/local/nginx/nginx
Open the browser to access the IP of this machine if the browser appears Welcome to nginx! Indicates that Nginx is installed and running successfully.

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.