Nginx Brief installation configuration method graphics and text tutorial _nginx

Source: Internet
Author: User
Tags openssl

Straight into the subject:

1, Nginx installation of the required documents

1), nginx-1.2.8.tar.gz

2), openssl-1.0.1g.tar.gz

3), pcre-8.31.tar.gz

4), zlib-1.2.7.tar.gz

The download address of the above installation package is normally available, because I am using the above version of the installation package, so the following installation are based on this.

2, the configuration of Linux machine environment

2.1. Java Environment

$java-version
java Version "1.8.0_45"
Java (tm) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot (tm 64-bit Server VM (build 25.45-b02, Mixed mode)

2.2, hardware configuration

3. Installation Steps

3.1, Decompression installation package

Enter the Nginx installation directory, extract openssl-1.0.1g.tar.gz, pcre-8.31.tar.gz, zlib-1.2.7.tar.gz, nginx-1.2.8.tar.gz four tar packets, respectively, by executing the command tar- ZXVF xxxx.tar.gz, where xxxx is the package name.

After decompression:

3.2. Compile and install package

First compile the 3 required library packages: openssl-1.0.1g, pcre-8.31, zlib-1.2.7.

Compile the openssl-1.0.1g, go to the file directory, and execute the following commands sequentially:

$./config$make$make Install

Normal installation results:

Compile the pcre-8.31, go to the file directory, and execute the following commands sequentially:

$./config
$make
$make Install

Normal installation results:

Compile the zlib-1.2.7, go to the file directory, and execute the following commands sequentially:

$./configure
$make
$make Install

Normal installation results:

Next, compile the Nginx installation package, go to the file directory, and execute./configure need to specify the path to the installation directory –prefix=/opt/nginx/nginx and the corresponding library file

sudo./configure--prefix=/opt/nginx/nginx--with-openssl=/opt/nginx/openssl-1.0.1g--with-pcre=/opt/nginx/ pcre-8.31--with-zlib=/opt/nginx/zlib-1.2.7

Next, compile the installation.

Copy Code code as follows:
sudo./configure--prefix=/opt/nginx/nginx--with-openssl=/opt/nginx/openssl-1.0.1g--with-pcre=/opt/nginx/ pcre-8.31--with-zlib=/opt/nginx/zlib-1.2.7

Next, compile the installation.

$make
$make Install

At this point, the Nginx installation is complete.

3.3, start Nginx

Enter Nginx installation directory/opt/nginx/nginx/sbin, execute./nginx start service.

[Dddd.et15sqa/opt/nginx/nginx/sbin]

$sudo./nginx

To view the service process after startup:

$ps Aux|grep Nginx
Root 2295 0.0 0.0 28264 804? Ss 23:30 0:00 nginx:master process./nginx
Nobody 2296 0.0 0.0 28660 1356? S 23:30 0:00 Nginx:worker Process
125233 2411 0.0 0.0 113720 1012 pts/0 s+ 23:31 0:00 grep nginx

Open nginx default home page:

Service installation and start-up ok!

4. Port forwarding

80 ports need to be forwarded to the Tomcat home page running on the server with a port of 8080.

Tomcat Home:

Configure the Nginx nginx.conf file as follows:

server {
    listen    ;
    server_name 127.0.0.1;

    #charset Koi8-r;

    #access_log Logs/host.access.log main;

    Location/{
      #root  html;
      #index index.html index.htm;
      Proxy_set_header Host $host;
      Proxy_set_header x-real-ip $remote _addr;
      Proxy_set_header x-forwarded-for $remote _addr;
      Proxy_pass http://127.0.0.1:8080;
    }

Restart the Nginx service,./nginx-s Reload

This allows access to port 80, but is actually a service that jumps to port 8080.

The article aims to help beginners familiar with the Nginx installation and simple port forwarding configuration, the content is relatively simple, if there are other complex configuration needs to refer to other information.

The above is nginx simple installation configuration method of the entire content, I hope to help you learn.

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.