Latest Questions
Post Top Ad
Your Ad Spot
Tuesday, June 25, 2019

20 Top NGINX Interview Questions and Answers {Updated}

NGINX Interview Questions and Answers for experienced PDF, Read commonly asked NGINX Job Interview Questions with Answers PDF for Freshers.

Read NGINX Interview Questions and Answers

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

Mention some special features of Nginx?
Special features of the Nginx server includes
  • Reverse proxy/ L7 Load Balancer
  • Embedded Perl interpreter
  • On the fly binary upgrade
  • Useful for re-writing URLs and awesome PCRE support

What is the difference between Nginx and Apache?
                      Nginx                                  Apache
  • Nginx is an event-based web server
  • All request are handled by a single thread.
  • Nginx avoids child processes idea.
  • Nginx resembles speed
  • Nginx is better when it comes to memory consumption and connection
  • Nginx is better when you want load-balancing
  • For PHP, Nginx might be preferable as it supports PHP internally
  • Nginx does not support O.S like IBMi and OpenVMS.
  • Nginx comes only with core features
  • Nginx performance and scalability do not depend on hardware
  •  Apache is a process based server
  • Single thread handles a single request.
  • Apache is based on child processes
  • Apache resemble power
  • Apache is not up to the mark when it comes to memory consumption and connection
  • Apache will refuse new connections when traffic reaches the limit of processes
  • Apache support’s PHP, Python, Perl and other languages using plugins. It is useful when the application is based on Python or Ruby
  • Apache support a much wider range of O.S
  • Apache provides a lot more functionality than Nginx
  • Apache is dependent on hardware components like CPU and memory

How Nginx can handle HTTP requests?
Nginx uses the reactor pattern.  The main event loop waits for the OS to signal a readiness event- such that the data is accessible to read from a socket, at which instance it is read into the buffer and processed.  A Single thread can serve tens of thousands of simultaneous connections.

In Nginx how you can prevent processing requests with undefined server names?
A server that just drops the requests can be defined as

Server {
listen                80;
server_name  “ “ ;
return              444;
Here the server name is kept as an empty string which will match request without the “Host” header field, and a special Nginx’s non-standard code 444 is returned that terminates the connection.

What is the advantage of using a “reverse proxy server”?
The reverse proxy server can hide the presence and characteristics of the origin server. It acts as an intermediate between the internet cloud and the web server. It is good for security reason especially when you are using web hosting services.

What is the best usage of Nginx server?
The best usage of Nginx server is to deploy dynamic HTTP content on a network with using SCGI, WSGI application servers, FastCGI handlers for scripts.  It can also serve as a load balancer.

What is the Master and Worker Processes in Nginx Server?
  • Master processes: It reads as well as evaluates configuration and maintains worker processes.
  • Worker processes: It actually does the processing of the requests.

How you can start Nginx through a different port other than 80?
To start Nginx through a different port, you have to go to /etc/Nginx/sites-enabled/ and if this is the default file, then you have to open the file called “default.” Edit the file and put the port you want
Like server { listen 81; }

Is it possible to replace Nginx errors like 502 error with 503?
  • 502= Bad gateway
  • 503= Server overloaded
Yes, it is possible but you to ensure that fastcgi_intercept_errors is set to ON, and use the error page directive.

Location / {
fastcgi_pass 127.0.01:9001;
fastcgi_intercept_errors on;
error_page 502 =503/error_page.html;

In Nginx, How you can keep double slashes in URLs?
To keep double slashes in URLs you have to use merge_slashes_off;
Syntax: merge_slashes [on/off]
Default: merge_slashes on
Context: http, server

What is ngx_http_upstream_module is used for?
The ngx_http_upstream_module is used to define groups of servers that can reference by the fastcgi pass, proxy pass, uwsgi pass, memcached pass, and scgi pass directives.

What is the C10K problem?
C10K problem is referred for the network socket unable to handle a large number of client (10,000) at the same time.

What is the use of stub_status and sub_filter directives?
  • Stub_status directive: This directive is used to know the current status of Nginx like current active connection, total connection accepted and handled the current number of read/write/wait connection
  • Sub_filter directive: It is used to search and replace the content in the response, and quick fix for stale data

Does Nginx support compress the request to the upstream?
You can compress the request to the upstream by using the Nginx modulegunzip. The gunzip module is a filter that decompresses responses with “Content Encoding: gzip” for clients or servers that do not support “gzip” encoding method.

How you can get the current time in Nginx?
To get the current time in Nginx, you have to use variables from SSI module, $date_gmt, and $date_local.
  • Proxy_set_header THE-TIME $date_gmt;

What is the purpose of –s with Nginx Server?
To run the executable file of Nginx –s parameter is used.

How to add modules in Nginx Server?
During the compilation process, Nginx modules must be selected as such run-time selection of modules is not supported by Nginx.

Post Top Ad

Your Ad Spot