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

Example Analysis of Nginx Service profile in LNMP Architecture

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

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail the example analysis of the Nginx service configuration file in LNMP architecture. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

The configuration file of nginx is relatively simple, but its function is quite powerful, and it can be configured freely and flexibly, so it is better to know this information about its configuration file.

1. Introduction of Nginx service directory structure

After the installation is complete, there will be Nginx directory information under the installation path

[root@centos6 application] # tree nginx

Nginx

+-- client_body_temp

+-- conf # nginx service profile directory

Profile +-- fastcgi.conf # fastcgi

Fastcgi.conf.default +--

Profile +-- fastcgi_params # fastcgi parameter profile

Fastcgi_params.default +--

Koi-utf +--

Koi-win +--

Mime.types +--

Mime.types.default +--

Nginx.conf +-- the main configuration file for the nginx service

Profile +-default profile for nginx.conf.default # nginx service

Scgi_params +--

Scgi_params.default +--

Uwsgi_params +--

Uwsgi_params.default +--

Win-utf +--

+-- fastcgi_temp

+-- html # compiles and installs the default home configuration file directory of nginx

Profile +-- 50x.html # error page profile

Profile +-index.html # default home profile

Index.html.bak +--

+-- logs # log configuration file directory

Access.log +-- access log file

Error.log +-- error log file

+-- proxy_temp

+-- sbin # command directory

Launch +-- nginx # Nginx service startup command

+-- scgi_temp # temporary directory

+-- uwsgi_temp

2. Introduction of Nginx service master configuration file

[root@centos6 conf] # egrep-v "# | ^ $" nginx.conf

Worker_processes 1; # number of worker processes

Events {# event

Worker_connections 1024; # concurrency, maximum number of connections per unit time

}

Http {

Include mime.types

Default_type application/octet-stream

Sendfile on

Keepalive_timeout 65

Server {# Virtual Host label

Listen 80; # Port number of the listener

Server_name localhost; # server hostname

Location / {

Root html; # default site directory

Index index.html index.htm; # default home page file

}

Error_page 500502 503 504 / 50x.htl; # error page file

Location = / 50x.html {

Root html

}

}

}

3. Nginx service help information

[root@centos6 conf] # / application/nginx/sbin/nginx-h

Nginx version: nginx/1.10.1 # version information

Usage: nginx [-? hvVtTq] [- s signal] [- c filename] [- p prefix] [- g directives]

Options:

-h: this help

-v: show version and exit

# display the version and exit

-V: show version and configure options then exit

# exit after displaying version information and configuration

-t: test configuration and exit

# check configuration (check syntax)

-T: test configuration, dump it and exit

-Q: suppress non-error messages during configuration testing

-s signal: send signal to a master process: stop, quit, reopen, reload

-p prefix: set prefix path (default: / application/nginx-1.10.1/)

-c filename: set configuration file (default: conf/nginx.conf)

# specify a profile instead of using nginx.conf

-g directives: set global directives out of configuration file

4. Check the compilation parameters of nginx

[root@centos6 conf] # / application/nginx/sbin/nginx-v

Nginx version: nginx/1.10.1

[root@centos6 conf] # / application/nginx/sbin/nginx-V

Nginx version: nginx/1.10.1

Built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)

Built with OpenSSL 1.0.1e-fips 11 Feb 2013

TLS SNI support enabled

Configure arguments:

-- user=nginx

-- group=nginx

-- prefix=/application/nginx-1.10.1

-- with-http_stub_status_module

-- with-http_ssl_module

-with-pcre=/download/tools/pcre-8.38

Check the parameters that are more practical in the actual production environment, such as the service is not installed by you, but there is no relevant documentation reference. This parameter can provide some relevant information.

This is the end of the article on "sample analysis of Nginx service configuration files in LNMP architecture". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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