Home > Backend Development > PHP Tutorial > Linux Server Setup Part 2 – Installing Web Server Nginx from Source Code

Linux Server Setup Part 2 – Installing Web Server Nginx from Source Code

WBOY
Release: 2016-07-29 08:57:52
Original
1020 people have browsed it

Linux Server Setup Part 2 – Installing the Web Server Nginx from Source Code

1. Environment introduction:

Linux version: CentOS 7 64-bit
nginx version: nginx-1.9.5
nginx is a lightweight web server that can be used as a load balancer and web server. The performance of nginx is very good. A single machine can theoretically support 50,000 concurrency

2. Preparation

1. Install the libraries required for nginx:
yum install -y gcc gcc-c++ zlib zlib-devel pcre pcre-devel openssl openssl-devel
Analysis:
gcc: gcc compiler
gcc-c++: c++ compiler used to compile nginx http module
zlib, zlib-devel: used to gzip compress the contents of http packages
pcre, pcre-devel: pcre library, required by the rewrite module in nginx
openssl, openssl-devel: used to support HTTP transmission over SSL protocol

2, user and user group:
groupadd www #Create www user group
useradd -g www www -s /sbin/nologin #Create www users into the www group, and prohibit www users from logging into the system
mkdir -p /alidata/server/nginx #Create nginx installation directory

3. Start installation:

cd /alidata/server/source
wget http://nginx.org/download/nginx-1.9.5.tar.gz #Get nginx source code
tar -zxvf nginx-1.9.5.tar.gz #Unzip
cd nginx-1.9.5 #Enter the source directory
./configure –user=www –group=www –prefix=/alidata/server/nginx –with->http_stub_status_module
–with-http_ssl_module –with-pcre
Use ./configure –help to check what compilation options are available. The nginx module must be added during compilation and cannot be added dynamically

Linux Server Setup Part 2 – Installing Web Server Nginx from Source Code
If it displays like this after executing the above, it is successful. Then execute the following command to complete the installation:

make && make install #Compile and install

Now nginx is installed.

4. Start:

Start ngin: (Make sure no other program in Linux occupies port 80)
cd /alidata/server/nginx #Enter the installation directory
./sbin/nginx #Start

If no error is reported, it means the startup is successful,
Enter the IP address of Linux in the browser, mine is: http://192.168.186.130. If the following information is displayed, it means the installation is successful.

Linux Server Setup Part 2 – Installing Web Server Nginx from Source Code
Attached are some learning materials for nginx: http://yun.baidu.com/share/link?shareid=309794494&uk=3156731279

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced the second part of the Linux server setup - installing the web server Nginx from the source code, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template