Nginx interview topics

1, please explain what is Nginx?

Nginx is a web server and a reverse proxy server for HTTP, HTTPS, SMTP, POP3 and IMAP protocols.

2, please list some of the features of Nginx.

Nginx server characteristics include:
reverse proxy / L7 load balancer
embedded Perl interpreter
dynamic binary upgrade
can be used to rewrite the URL, has a very good support PCRE

3, please list the differences between Nginx and Apache

1, nginx advantages with respect to the apache

2, as a Web server: compared to Apache, Nginx use fewer resources to support more concurrent connections, reflecting higher efficiency, especially by this point the Nginx web hosting provider welcome.

3, Nginx configuration is simple, Apache complicated, Nginx static processing performance more than three times higher than the Apache, Apache is relatively simple support for PHP, Nginx need to cooperate with other back-end, Apache components than Nginx, is now the preferred Nginx Web server

Nginx requests for dynamic handling weak, that I want to achieve it and the bar itself, it needs to be combined with other modules to support languages such as PHP, and Apache are supported as well;
4, the core difference is that apache is a multi-process synchronization model, a connection corresponds to a process; nginx is asynchronous, multiple connections (million level) may correspond to a process

4, please explain how to deal with Nginx HTTP request.

Nginx reactive mode. Main event loop Wait signal operating system issues prepared events, so that data can be read from the socket, in this example, is read into the buffer and processed. A single thread may be provided tens of thousands of concurrent connections.

5, Nginx, how to use an undefined server names to stop processing the request?

Requesting server simply deleted can be defined as:
Server {the listen 80; server_name ""; 444 return;
}
Here, the server names are reserved as an empty string, it will not "matching Host" header field case request, and a special Nginx nonstandard code 444 is returned, thereby terminating the connection.

6. What are the advantages of using "reverse proxy server" is?

Reverse proxy server to hide the existence and identity of the source server. It acts as an intermediate layer between the Internet cloud and web servers. This security is very good, especially if you use a web hosting service time.

7, please list the best use Nginx server.

Best use Nginx server is deployed on the network dynamic HTTP content, use SCGI, WSGI application server for FastCGI handler script. It can also be used as a load balancer.

8, please explain Master and Worker processes on Nginx server What is the difference?

Master process : read and evaluate the configuration and maintenance of
Worker process : process the request

9, please explain how you open a port through Nginx is different from 80?

To open Nginx through a different port, you must enter the / etc / Nginx / sitesenabled /, if this is the default file, then you must open the file named "default" of. Edit the file and placed in the port you want:
Like the listen Server 81 {;}

10. Please explain whether it is possible to replace the Nginx error 502 errors, 503?

Bad Gateway 502 =
503 = server overload
is possible, but you can be sure fastcgi_intercept_errors is set to ON, and using the wrong page directive.
Location / {fastcgi_pass 127.0.01: 9001; fastcgi_intercept_errors on; error_page 502 = 503 / error_page.html; # ...}

11, Nginx, it is explained how to retain the double slash in the URL?

To retain the double slash in the URL, you must use merge_slashes_off;
syntax: merge_slashes [on / off]
Default value: merge_slashes on
the environment: http, server

12, ngx_http_upstream_module please explain what is the role?

ngx_http_upstream_module defined by fastcgi for transfer, proxy transfer, uwsgi transfer, memcached scgi transfer and delivery instructions to reference the server group.

13, please explain what is the C10K problem?

C10K problem refers to the network socket could not be processed at the same time a large number of clients (10,000).

14, please state what stub_status and sub_filter instruction is the role?

Stub_status command: This command is used to understand the current state of the current state of Nginx, such as the current active connections, accept and deal with the current read / write / total number waiting for connection
Sub_filter instructions: It is used to search and replace content in response to, and quick fixes stale data

15, explained Nginx whether to support the request to the upstream compression?

You can use the module Nginx gunzip compressed to request upstream. gunzip module is a filter, it can be "the gzip" encoding method client or server does not support the use of the "Content-Encoding: gzip" in response to decompression.

16, explains how to get the current time in Nginx in?

Nginx to get the current time, you must use the SSI module, d a t e g m t with date_gmt sum date_local variables.
Proxy_set_header THE-TIME $ date_gmt;

17, explained Nginx server -s what purpose?

Used to run an executable file Nginx -s parameter.

18, explains how to add modules on Nginx server?

During compilation, you must choose Nginx module, because Nginx does not support runtime module of choice.

Published 74 original articles · won praise 232 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_43107323/article/details/104863372