Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Compile and install Nginx under CentOS 6

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Compile and install Nginx under CentOS 6

By: Lao Ning

First, prepare the make environment

Yum-y install gcc gcc-c++ automake autoconf libtool make

Second, prepare the Nginx environment

Install pcre or zlib, the former for rewriting rewrite, or for gzip compression.

Install openssl

1. Install the PCR library

Cd / usr/local/src/

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

Tar-zxvf pcre-8.40.tar.gz

Cd pcre-8.40

. / configure

Make

Make install

2. Install the zlib library

Cd / usr/local/src/

Wget https://jaist.dl.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz

Tar-zxvf zlib-1.2.11.tar.gz

Cd zlib-1.2.11

. / configure

Make

Make install

3. Install ssl (ssl is not installed by default under some vps)

Cd / usr/local/src/

Wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz

Tar-zxvf openssl-1.0.1t.tar.gz

Third, install Nginx

There are generally two versions of Nginx, the development version and the stable version. We choose a stable version and install Nginx into the / usr/local/nginx directory:

1. Install Nginx

Wget http://mirrors.sohu.com/nginx/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\ # install nginx into the / usr/local/nginx directory

-- conf-path=/usr/local/nginx/nginx.conf\ # install the conf (program configuration file) file to the / usr/local/nginx directory

-- pid-path=/usr/local/nginx/nginx.pid\ # install the pid (daemon file) file to the / usr/local/nginx directory

-- with-http_ssl_module\ # specify ssl module (dependent on openssl)

-- with-pcre=/usr/local/src/pcre-8.40\ # specify the calling path of pcre (perl language compatible regular expression)

-- with-zlib=/usr/local/src/zlib-1.2.11\ # specify the calling path of zlib (a library that provides data compression)

-- with-openssl=/usr/local/src/openssl-1.0.1t\ # specify the calling path of openssl (secure Sockets layer password Base)

Make

Make install

2. Enable Nginx

Ensure that port 80 is not occupied, go to the Nginx installation directory / usr/local/src/nginx, and execute:

. / nginx # start the nginx service

Ps-aux | grep nginx # check whether the Nginx process is enabled

Netstat-ano | grep 80 # check whether port 80 is enabled

3. Whether the browser is installed successfully or not

Enter Nginx to use the IP address. If "Welcome to nginx!" appears, it means that the installation and operation is successful!

At this point, the installation of nginx is complete. If you only deal with static html, you don't have to continue the installation.

If you need to deal with php scripts, you also need to install php-fpm.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report