The opening is introduced
Hello everyone, I am the Java most comprehensive test database of the jeans sister, today this is the fourth article distributed technology, mainly introduces Nginx; In the follow-up, I will sum up the knowledge line at the beginning of the first chapter all the way to the day! If I can do 100 days 100 more, I hope you can follow 100 days 100 brush, 100 days to develop a good habit.
What is the Nginx?
Nginx is a Web server and reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols.
List some features of Nginx
Nginx server features include:
- Reverse proxy /L7 Load balancer
- Embedded Perl interpreter
- Dynamic binary upgrade
- Can be used to rewrite urls with very good PCRE support
How does Nginx handle HTTP requests?
Nginx uses the reactor pattern. The main event loop waits for the operating system to signal that it is ready for an event so that data can be read from the socket, read into the buffer in this instance, and processed. A single thread can provide tens of thousands of concurrent connections.
How can an undefined server name be used in Nginx to prevent requests from being processed?
You only need to define the Server to be deleted as: Server{listen80; Server_name “; return444; } The server name is left as an empty string, which will match the request without a “host” header field, and a special Nginx non-standard code 444 is returned, terminating the connection.
What are the advantages of using a “reverse proxy server”?
A reverse proxy server can hide the existence and features of the source server. It acts as an intermediate layer between the Internet cloud and the Web server. This is great for security, especially when using Web hosting services.
Best use of Nginx server.
The best use of Nginx servers is to deploy dynamic HTP content on the network, using SCGI, WSGl application servers, and FastCGI handlers for scripts. It also acts as a load balancer.
What are the Master and process on the Nginx server?
Master process: reads and evaluates the configuration and maintains Worker process: processes requests
Please explain how you can start Nginx through a different port than 80.
To enable Nginx through a different port, you must go to /etc/nginx/sites-enabled /. If this is the default file, then you must open a file named default “. Edit the file and place it on the port you want: Like server {listen 81; }
Is it possible to replace Nginx errors with errors 502 and 503?
502= Error gateway 503= Server overload is possible, but make sure that fastcGI_intercept_errors is set to ON and the error page directive is used.
The Location/fastcgi_pass 127.0.01:9001; fastcgi_intercept_error on; error_page 502 =503/errorpage. html; #... }Copy the code
In Nginx, how do I keep a double slash in a URL?
To keep double slashes in urls, you must use the merge_slashes_off syntax: merge_slashes [on/off] Default: merge_slashes on Environment: HTTP, server
What is the function of ngx_HTTP_ upstream_module?
Ngx_http_upstream_module is used to define groups of servers that can be referenced by fastCGI delivery, proxy delivery, UWSGI delivery, memcached delivery, and SCGI delivery instructions.
What is a C10K problem?
The C10K problem is the inability to handle a large number of clients (10,000) of network sockets simultaneously.
Please state what the stub_STATUS and sub_filter directives do.
The Stub_status directive is used to know the current state of the current state of the Nginx, such as the current active connections, the total number of read/write/wait connections accepted and processed, and the Sub_filter directive is used to search and replace the contents of the response and quickly fix stale data
Explain does Nginx support compression of requests upstream?
Requests can be compressed upstream using the Nginx module Gunzip. The gunzip module is a filter that decompresses responses using “content encoding :gzip” for clients or servers that do not support the “gzip” encoding method.
How do I get the current time in Nginx?
To get the current time of Nginx, you must use the SSl module, $date_GMT, and date_local variables. Proxy_set_header THE-TIME $date_gmt;
What is the purpose of interpreting -s with Nginx servers?
The executable used to run the Nginx-s argument.
How to add modules to Nginx server
During compilation, you must select the Nginx module because Nginx does not support runtime selection for modules.