Marco Linux Learning compilation-nginx

Source: Internet
Author: User

Nginx is an open-source software for a lightweight Web server developed by Russians, and is now ranked second in Web server usage because of its high performance, low resource consumption, and support capabilities. This article introduces the installation of Nginx compiler.

Platform: CentOS 6.6 final version ip:192.168.127.128.

SSH tool: Xshell

First, download the required version of Nginx and upload to the server

1, today on the Http://nginx.org official website to see a bit, the new stable version has been to 1.8.0, so I made this the latest version.

2, using Xshell's SFTP tool, can be directly uploaded to the server.

650) this.width=650; "title=" Bianyi-nginx-put.png "src=" Http://s3.51cto.com/wyfs02/M00/6C/0A/wKioL1U-Rw_ Tirdoaajbbz39fg8075.jpg "alt=" Wkiol1u-rw_tirdoaajbbz39fg8075.jpg "/>

This will put the source package on the server, of course, if the server can, you can also download directly on the server.

Second, compile and resolve the package dependencies by error

1, we will install Nginx into the/usr/local/nginx directory, then we first create the Nginx directory.

#mkdir/usr/local/nginx

We then use the./configure--prefix=/usr/local/nginx to perform a compilation environment configuration check. As a result, the first of the following errors occurred,

650) this.width=650; "title=" Cc-not-found.png "src=" http://s3.51cto.com/wyfs02/M01/6C/0E/ Wkiom1u-r5ktmz6yaacwtprljy0482.jpg "alt=" Wkiom1u-r5ktmz6yaacwtprljy0482.jpg "/>

Search Baidu by mistake, find need to install GCC, gcc-c++, Ncurses-devel, Perl, so we put these packages installed. I use the Yum installation because Yum installs these packages and automatically installs their dependent packages. The last time I learned the Yum source configuration was useful.

[email protected] local]# Yum install-y gcc gcc-c++ ncurses-devel perl

After we've installed all of the above, we'll run the build environment configuration check again. The result is the following error.

650) this.width=650; "title=" Pcre-lib-no.png "src=" http://s3.51cto.com/wyfs02/M01/6C/0E/ Wkiom1u-ssqzexymaaf0ptrsyo4399.jpg "alt=" Wkiom1u-ssqzexymaaf0ptrsyo4399.jpg "/>

There is nothing to say, look at the hint can be clearly found missing Pcre library, so install Pcre-devel.

[email protected] local]# Yum install-y pcre-devel

Then perform the compilation environment configuration check. The result is the following error.

650) this.width=650; "title=" Zlib-no.png "src=" http://s3.51cto.com/wyfs02/M00/6C/0E/ Wkiom1u-sohhhpnjaag02i1he20942.jpg "alt=" Wkiom1u-sohhhpnjaag02i1he20942.jpg "/>

The discovery is the lack of zlib library, also put it installed.

[email protected] local]# Yum install-y zlib-devel

The compilation environment configuration check is then performed.

650) this.width=650; "title=" Openssl-lib-no.png "src=" http://s3.51cto.com/wyfs02/M01/6C/0A/ Wkiol1u-tg7syollaadozj-jjds393.jpg "alt=" Wkiol1u-tg7syollaadozj-jjds393.jpg "/>

Install the Openssl-devel.

[email protected] local]# Yum install-y openssl-devel

Again,/configure finally passed, no error, stating that the package of related dependencies all have.

third, compile and install

This seems like nothing to say, just use the Make&&make install command.

Four, nginx configuration file

If you do not specify the Nginx profile path at compile time, the default is nginx.conf in the Conf directory under its installation directory as its master profile.

Five, Nginx startup, shutdown and reload configuration files

Nginx startup, shutdown, and reload are performed using the Nginx program under the Sbin directory under the installation directory.

To start the use command:

[Email protected] nginx]#/usr/local/nginx/sbin/-c/usr/local/nginx/conf/nginx.conf

To close, reload the configuration file using the command:

[Email protected] nginx]#/usr/local/nginx/sbin/-S [stop|reload]

Of course, we can add the path of its running program to the system path path, we can directly use the command Nginx.

Well, it's all very basic, and in-depth it depends on the official documents.

Marco Linux Learning compilation-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.