Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx compilation and installation tutorial under Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the "nginx compilation and installation tutorial under Linux" related knowledge, in the actual case operation process, many people will encounter such a dilemma, and then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!

I. necessary software preparation

1. Install pcre

To support the rewrite feature, we need to install pcre

The copy code is as follows: # yum install pcre* / / if you have already installed it, please skip this step

two。 Install openssl

Ssl support is required. If you do not need ssl support, please skip this step

The copy code is as follows: # yum install openssl*

3.gzip class library installation

The copy code is as follows: yum install zlib zlib-devel

4. Install wget

Download nginx for use, if it is already installed, skip this step

The copy code is as follows: # yum install wget

Second, install nginx

1. download

The copy code is as follows: wget http://nginx.org/download/nginx-1.7.0.tar.gz

two。 Decompression

The copy code is as follows:

Tar-zxvf nginx-1.7.0.tar.gz

3. Compile and install

Execute the following command:

The copy code is as follows:

Cd nginx-1.7.0./configure-- prefix=/usr/local/nginx-1.7.0\

-with-http_ssl_module-- with-http_spdy_module

-with-http_stub_status_module-- with-pcre

-with-http_stub_status_module: support nginx status query

-with-http_ssl_module: supports https

-with-http_spdy_module: spdy that supports google. If you want to know more about Baidu spdy, this must be supported by ssl.

-with-pcre: in order to support the rewrite rewriting function, pcre must be established

Finally, the output is as follows, indicating configure OK.

The copy code is as follows:

Checking for zlib library... Found

Creating objs/Makefile

Configuration summary

Using system PCRE library

Using system OpenSSL library

Md5: using OpenSSL library

Sha1: using OpenSSL library

Using system zlib library

Nginx path prefix: "/ usr/local/nginx-1.7.0"

Nginx binary file: "/ usr/local/nginx-1.7.0/sbin/nginx"

Nginx configuration prefix: "/ usr/local/nginx-1.7.0/conf"

Nginx configuration file: "/ usr/local/nginx-1.7.0/conf/nginx.conf"

Nginx pid file: "/ usr/local/nginx-1.7.0/logs/nginx.pid"

Nginx error log file: "/ usr/local/nginx-1.7.0/logs/error.log"

Nginx http access log file: "/ usr/local/nginx-1.7.0/logs/access.log"

Nginx http client request body temporary files: "client_body_temp"

Nginx http proxy temporary files: "proxy_temp"

Nginx http fastcgi temporary files: "fastcgi_temp"

Nginx http uwsgi temporary files: "uwsgi_temp"

Nginx http scgi temporary files: "scgi_temp"

Make / / make sure your server has make installed. If not, execute yum install makemake install.

Start, shut down, and reset nginx

Startup: directly execute the following command, nginx will start, do not need to change any configuration file, nginx configuration multi-domain virtual host please refer to the following article.

The copy code is as follows: / usr/local/nginx-1.7.0/sbin/nginx

Try visiting: use the curl command directly to read web information

The copy code is as follows:

[root@ns conf]

Curl-s http://localhost | grep nginx.com

Nginx.com.

Close:

The copy code is as follows: / usr/local/nginx-1.7.0/sbin/nginx-s stop

This is the end of the "nginx compilation and installation tutorial under Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report