0% found this document useful (0 votes)
35 views

Top 18 Nginx Interview Question

Guru99 provides free online tutorials covering a variety of topics including Java, Python, Data Science, Cloud Computing and more. The page lists over 18 different courses that users can learn including tutorials on technologies like Java, MongoDB, Big Data, Web Services, R Programming and TensorFlow. It also shares the top 18 Nginx interview questions and their answers covering topics such as what Nginx is, how it handles requests, load balancing, modules and more.

Uploaded by

Sanket Pandhare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Top 18 Nginx Interview Question

Guru99 provides free online tutorials covering a variety of topics including Java, Python, Data Science, Cloud Computing and more. The page lists over 18 different courses that users can learn including tutorials on technologies like Java, MongoDB, Big Data, Web Services, R Programming and TensorFlow. It also shares the top 18 Nginx interview questions and their answers covering topics such as what Nginx is, how it handles requests, load balancing, modules and more.

Uploaded by

Sanket Pandhare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

https://career.guru99.

com/

Guru99 Provides FREE ONLINE TUTORIAL on Various courses like

Java | MIS | MongoDB | BigData | Cassandra | Web Services


-------------------------------------------------------------------------------------------------------------------------------
SQLite | JSP | Informatica | Accounting | SAP Training | Python
-------------------------------------------------------------------------------------------------------------------------------
Excel | ASP Net | HBase | Testing | Selenium | CCNA | NodeJS
-------------------------------------------------------------------------------------------------------------------------------
TensorFlow | Data Warehouse | R Programming | Live Projects | DevOps
-------------------------------------------------------------------------------------------------------------------------------

Top 18 Nginx Interview Questions & Answers


1) Explain what is Nginx?

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

2) 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

3) Mention what is the difference between Nginx and Apache?

Nginx Apache
Nginx is an event based web server Apache is a process based server
All request are handled by a single Single thread handles a single request.
thread. Apache is based on child processes
Nginx avoids child processes idea. Apache resemble power
Nginx resembles speed Apache is not up-to the mark when it
Nginx is better when it comes to comes to memory consumption and
memory consumption and connection connection
Nginx is better when you want load- Apache will refuse new connections
balancing when traffic reaches the limit of
For PHP, Nginx might be preferable as processes
it supports PHP internally Apache support’s PHP, Python, Perl
Nginx do not support O.S like IBMi and and other languages using plugins. It is
OpenVMS. useful when application is based on

1/4
https://career.guru99.com/

Nginx comes only with core features Python or Ruby


Nginx performance and scalability do Apache support much wider range of
not depend on hardware O.S
Apache provides lot more functionality
than Nginx
Apache is dependent on hardware
components like CPU and memory

4) Explain 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.

5) 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.

6) 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 internet cloud and web server. It is good for security reason
especially when you are using web hosting services.

2/4
https://career.guru99.com/

7) Mention 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.

8) Mention 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.

9) Explain 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 file called “default.” Edit the file and put the port you want

Like server { listen 81; }

10) Explain 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;

#...

11) In Nginx, explain 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]

3/4
https://career.guru99.com/

Default: merge_slashes on

Context: http, server

12) Explain 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.

13) Explain what is C10K problem?

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

14) Mention 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 current number of
read/write/wait connection
Sub_filter directive: It is used to search and replace the content in response, and quick
fix for stale data

15) Explain does Nginx support compress the request to the upstream?

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

16) Explain 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;

17) Explain what is the purpose of –s with Nginx Server?

To run the executable file of Nginx –s parameter is used.

18) Explain 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.

4/4
Powered by TCPDF (www.tcpdf.org)

You might also like