Linux Download Install Nginx and configure

Source: Internet
Author: User
Tags install openssl

1, install Nginx basic software Preparation

First install these software: PCRE (Perl Compatible Regular Expression), OPENSSL,GCC.

Nginx is written in C, need to compile with GCC, Nginx rewrite and HTTP module will use Pcre.

#It is recommended to use Yum to install Pcre-y to indicate the default Yes devel, which means the develop development package[[Email protected] ~]#yum-y Install pcre pcre-devel#after installation, check[[Email protected] ~]#Rpm-qa pcre pcre-develPcre-7.8-7. El6.x86_64pcre-devel-7.8-7. el6.x86_64#Installing OpenSSL[[Email protected] ~]#yum-y Install Openssl-devel[[Email protected]~]#Rpm-qa OpenSSL openssl-developenssl-devel-1.0.1e-48.el6_8.3. X86_64openssl-1.0.1e-48.el6_8.3.x86_64

2. Start installing Nginx Service
# This user is required to start the Nginx service [[Email protected] ~] # useradd nginx-s/sbin/nologin-m

Check the user you just added

[[Email protected] ~] # ID nginxuid=500 (nginx) gid=500 (nginx) groups=500 (Nginx)

Create a special catalog of download tools and enter

1 [[email protected]/]#  mkdir/home/tools2 [[email protected]/]#  cd/home/tools/

2.1. Download Nginx1.6.3
1 # Use this command to be able to surf the internet 2 2 [[email protected] tools]#  wget-q http://nginx.org/download/nginx-1.6.3.tar.gz3 [[email protected] tools]#  ll4 Total 7885 -rw-r--r--. 1 root root 805253 Apr 8 nginx-1.6.3.tar.gz
2.2. Unzip & compile & install Unzip:
1 [[email protected] tools]#  tar-zxvf nginx-1.6.3.tar.gz

1 [[email protected] tools]#  cd nginx-1.6.3

Compile:

When compiling Nginx software, you can use the./configure--help to view the relevant parameter help, the following is the parameters specified at compile time and simple description:

--prefix=path Setting the installation path

--user= Process User Rights

--group= Process User group permissions

--with-http_ssl_module Activation status information

--with-http_stub_status_module activating the SSL feature

1 [[email protected] nginx-1.6.3]#  ./configure--prefix=/application/nginx-1.6.3--user=nginx- -group=nginx--with-http_ssl_module--with-http_stub_status_module

echo $? : This command looks for any errors in the execution process.

[[email protected] nginx-1.6.3] # echo $? 0

Installation:

Make && do install (makeis compiler, make install is a real installation)

After the installation is complete, create a soft link

1 [[email protected] nginx-1.6.3]#  ln-s/application/nginx-1.6.3//application/nginx

To start the nginx command:

1 [[email protected] nginx-1.6.3]#  /application/nginx/sbin/nginx

Check

Ps-ef checking for initiated processes

1 [[email protected] nginx-1.6.3]#  ps-ef|grep nginx|grep-v grep

Ss-lntup

1 [[email protected] nginx-1.6.3]#  ss-lntup|grep nginx

3. Verifying Nginx Service

Direct access to the IP address on the Web page:

If you cannot access this website:

(1) You can ping the IP address you need to access in Windows cmd

(2) Using Telnet, Connection failed

Analysis: The local is good, and the service is open, but from the client to Linux does not, the firewall is not closed:

Check the firewall:

1 [[email protected] nginx-1.6.3]#  /etc/init.d/iptables status

Shutting down the firewall

1 [[email protected] nginx-1.6.3]#  /etc/init.d/iptables Stop

Enter IP Access again:

Linux Download Install Nginx and configure

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.