Linux installation Nginx

Source: Internet
Author: User
Tags openssl openssl library

Linux installation Nginx Blog Category:
    • Server
1) Download Nginx
Java code
    1. wget http://nginx.org/download/nginx-0.8.54.tar.gz

The default is downloaded to the current directory, which is the PWD directory

2) Unzip
Java code
    1. Tar zxvf nginx-0.8. 54.tar.gz

Enter Nginx Directory CD nginx-0.8.54
3) Java code
    1. ./configure


Configure this step may appear, can not find pcre error
Then if you can use the Yum command to install the dependency package.
Java code
    1. Yum-y install gcc pcre-devel OpenSSL openssl-devel

If you do not have a network, you can find the following packages under the CentOS 5.5 DVD, installed sequentially
Java code
  1. RPM-IVH pcre-devel-6.6-2.el5_1. 7.i386.rpm
  2. RPM-IVH openssl-0.9.8e-12.el5_4. 6.i386.rpm
  3. RPM-IVH e2fsprogs-devel-1.39-23.el5.i386.rpm
  4. RPM-IVH keyutils-libs-devel-1.2-1.el5.i386.rpm
  5. RPM-IVH libsepol-devel-1.15. 2-3.el5.i386.rpm
  6. RPM-IVH libselinux-devel-1.33. 4-5.5.el5.i386.rpm
  7. RPM-IVH krb5-devel-1.6. 1-36.el5_4. 1.i386.rpm
  8. RPM-IVH zlib-devel-1.2. 3-3.i386.rpm
  9. RPM-IVH openssl-devel-0.9.8e-12.el5_4. 6.i386.rpm


Install and then execute./configure
You will see a message similar to the following to indicate that the compilation was successful
Java code
    1. Configuration Summary
    2. + Using System PCRE Library
    3. + OpenSSL Library is not used
    4. + md5:using System Crypto Library
    5. + SHA1 Library is not used
    6. + Using System zlib Library


4) Java code
    1. Make

5) Java code
    1. Make install


Install to Java code by default
    1. /usr/local/nginx
Directory below

6) Start Java code
    1. /usr/local/nginx/sbin/nginx


To see if it started successfully
Java code
  1. [Root@maomao sbin]# ps aux | grep nginx
  2. Root     10391  0.0   0.0   4008    456 ?        ss    10:48   0: 00 nginx: [b][color=red]master[/color][/b] process ./nginx  
  3. Nobody 10392 0.0 0.0 4164 796? S : 0:nginx:worker process

Start successfully, Master is the main process, kill the process when it is closed, other sub-processes will automatically turn off

Open your browser http://localhost/to see the default Welcome page for Nginx
Welcome to nginx!

Nginx default is 80 port, we can be in the Nginx installation directory under the conf/nginx.conf file changes.
Java code
    1. Vim/usr/local/nginx/conf/nginx.conf

Locate the following fragment to make changes, and then restart
Java code
    1. server {
    2. Listen 80; //Port
    3. server_name localhost; //bind domain name
    4. Location/{
    5. root HTML; //default directory
    6. Index index.html index.htm; //default home name
    7. }
    8. }


After the change, restart Nginx.
Java code
    1. Kill-hup ' Cat/usr/local/nginx/logs/nginx.pid '

Hup signal is a smooth restart

Stop Nginx
Java code
    1. Kill ' Cat/usr/local/nginx/logs/nginx.pid '

Linux installation Nginx

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.