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

How to use Nginx

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces the knowledge of "how to use Nginx". In the operation of actual cases, many people will encounter such a dilemma. Next, 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!

Compile Nginx

For Unix environment

Download Nginx

Download the Nginx,Nginx version you want to compile from the Nginx official website. There are three official versions available:

Mainline version

Mainline version, the function is newer, the stability is slightly worse than Stable version, it is recommended to learn to use this version, the actual production uses Stable version.

Stable version

Stable version

Legacy versions

Historical version

Wget http://nginx.org/download/nginx-1.17.4.tar.gztar-introduction to the zxvf nginx-1.17.4.tar.gzcd nginx-1.17.4Nginx source directory

Auto

Dependent libraries at compile time and selecting libraries for operating system features

CHANGES

Notes on the changes of each version of Nginx in English

CHANGES.ru

Notes on changes to each version of the Russian version of Nginx (Nginx author is Russian)

Conf

Configuration file directory

Configure

Compile configuration, generate intermediate files before compilation to facilitate compilation

It mainly includes compilation path configuration, some function switches and module configuration.

-- prefix sets the server storage address, which is also the default root directory for other directories with no configured paths.

-- XXX-path stands for setting the address of the XXX directory

-- with-XXX_module stands for enabling certain modules

-- without-XX_module represents a module that is disabled when Nginx compiles by default

There are some other parameters that you can refer to. You can refer to the Ngxin official documentation.

Contrib

Vim prompt plug-ins and some tool scripts to improve the efficiency of using Nginx

Configure vim prompt

Cp-r contrib/vim ~ / .vim

The difference will be more obvious according to different hierarchical structure and different keyword color.

Html

Store index.html (Nginx default welcome page) and 50x.html (Nginx default error page)

Index.html:

50x.html:

LICENSE

License Information

Man

Help files provided by Nginx for linux

Can be viewed using the command (richer than using nginx-h after compilation)

Man man/nginx.8

README

README file

Src

Source code

Compile

First of all, you need to use configure for configuration. Generally, you can only set-- prefix:

. / configure-- prefix=/home/sanchan/nginx

The configuration outputs a brief description of the configuration:

Configuration summary using system PCRE library + OpenSSL library is not used + using system zlib library nginx path prefix: "/ home/sanchan/nginx" nginx binary file: "/ home/sanchan/nginx/sbin/nginx" nginx modules path: "/ home/sanchan/nginx/modules" nginx configuration prefix: "/ home/sanchan/nginx/conf" nginx configuration file: "/ home/sanchan/nginx/conf/nginx.conf" nginx pid file: "/ home/sanchan/nginx/logs/nginx.pid "nginx error log file:" / home/sanchan/nginx/logs/error.log "nginx http access log file:" / home/sanchan/nginx/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 "

The intermediate files generated by the configuration will be placed in the objs directory, which can be seen by interested partners.

Then you can compile:

Make

The compilation will produce nginx, nginx.8, and ngx_modules.o in the objs directory. If you are upgrading Nginx, you can replace these files with the old files, or if it is a fresh installation, execute:

Make install

So you can see the Nginx-related files in the previously configured path / home/sanchan/nginx.

Sbin executes the file directory for the Nginx binary

Logs is the Nginx log directory

Conf and html are the same as the directory in the downloaded Nginx source code.

This is the end of "how to use Nginx". 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

Internet Technology

Wechat

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

12
Report