Nginx Interview Questions & Answers

  1. Question 1. What Is Nginx Server?

    Answer :

    Nginx is an open source web server and a reverse proxy server for HTTP,SMTP, POP3, and IMAP protocols with a strong focus on high concurrency,performance and low memory usage. It is pronounced as “engine x”.

  2. Question 2. Who Is Author Of Nginx?

    Answer :

    Igor Sysoev

  3. MySQL Interview Questions

  4. Question 3. In Which Language Nginx Is Written?

    Answer :

    ‘C’ Language.

  5. Question 4. What Is Official Website Of Nginx?

    Answer :

    nginx.org

  6. MySQL Tutorial

  7. Question 5. When Nginx’s Stable Version Launched?

    Answer :

    5 August 2014

  8. HTTP Interview Questions

  9. Question 6. What Is The Best Usage Of Nginx Server?

    Answer :

    Nginx can deploy dynamic HTTP content on a network with using of SCGI,FastCGI handlers for scripts, WSGI application servers or Phusion Passenger module. Nginx can also serve as a load balancer.

  10. Question 7. What Is The Difference Between Apache Web Server And Nginx?

    Answer :

    Nginx uses an asynchronous event approach to handling multiple requests whereas Apache Web Server use the synchronous. Nginx’s event­driven approach can provide more predictable performance under high loads. 
    Apache Web Server handling multiple request
    |—­A—–||—–B———–||——­C——|
    Nginx handling multiple request
    |—­A—–|
    |—–B———–|
    |——­C——|

    In this way, Nginx is far better than Apache.

  11. HTTP Tutorial
    Docker (software) Interview Questions

  12. Question 8. What Are Features Of Nginx?

    Answer :

    • Simultaneous Connections with low memory
    • Auto Indexing
    • Load Balancing
    • Reverse Proxy with Caching
    • Fault Tolerance
  13. Question 9. What Are All Feature Of Nginx Server?

    Answer :

    • Ability to handle more than 10,000 simultaneous connections with a low memory.
    • Handling of static files, index files, and auto­indexing 
    • Reverse proxy with caching
    • Load balancing with in­band health checks
    • Fault tolerance
    • TLS/SSL with SNI and OCSP stapling support, via OpenSSL.
    • FastCGI, SCGI, uWSGI support with caching
    • FastCGI via PHP (PHP­FPM) support with caching
    • Name­ and IP address­based virtual servers
    • IPv6­compatible
    • SPDY protocol support 
    • WebSockets and HTTP/1.1 Upgrade (101 Switching Protocols)
    • FLV and MP4 streaming
    • Web page access authentication
    • gzip compression and decompression
    • URL rewriting
    • Custom logging with on­the­fly gzip compression
    • Response rate and concurrent requests limiting
    • Server Side Includes
    • IP address­based Geo­Location
    • User tracking
    • WebDAV
    • XSLT data processing
    • Embedded Perl scripting
    • TLS/SSL support
    • STARTTLS support
    • SMTP, POP3, and IMAP proxy
    • Authentication using an external HTTP server
    • Upgrading executable and configuration without client connections loss and a module­based architecture.
  14. Amazon Web Services (AWS) Interview Questions

  15. Question 10. Explain How You Can Start Nginx Through A Different Port Other Than 80?

    Answer :

    To start Nginx through a different port, you have to go to /etc/Nginx/sitesenabled/ 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; }

  16. Docker (software) Tutorial

  17. Question 11. Where The Process Id Does For Nginx Server?

    Answer :

    The process ID of the master process is written in the file /usr/local/nginx/logs/nginx.pid

  18. NoSQL Interview Questions

  19. Question 12. What Are The Controls Used In Nginx Server?

    Answer :

    Nginx ­s [stop | quit | reopen | reload]

  20. MySQL Interview Questions

  21. Question 13. What Is The Purpose Of –s With Nginx Server?

    Answer :

    -s parameter is used to run the executable file of nginx.

  22. Unix/Linux Tutorial

  23. Question 14. How To Add Modules In Nginx Server?

    Answer :

    • Nginx modules must be selected during compile.
    • Run­time selection of modules is not supported by Nginx.
  24. Question 15. What Is The Advantage Of Using A “reverse Proxy Server”?

    Answer :

    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.

  25. LAMP Interview Questions

  26. Question 16. Mention What Is The Best Usage Of Nginx Server?

    Answer :

    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.

  27. Question 17. What Is The Master And Worker Processes In Nginx Server?

    Answer :

    • Worker processes: It reads and evaluate configuration and maintain worker processes.
    • Master processes: It actually does the processing of the requests.
  28. XMLHttpRequest (XHR) Interview Questions

  29. Question 18. Explain Is It Possible To Replace Nginx Errors Like 502 Error With 503?

    Answer :

    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;
    #…
    }

  30. HTTP Interview Questions

  31. Question 19. In Nginx, Explain How You Can Keep Double Slashes In Urls?

    Answer :

    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

  32. Question 20. What Is Ngx_http_upstream_module Is Used For?

    Answer :

    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.

  33. Apache Tomcat Interview Questions

  34. Question 21. What Is C10k Problem?

    Answer :

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

  35. Question 22. What Is The Use Of Stub_status And Sub_filter Directives?

    Answer :

    • 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
  36. Question 23. Explain Does Nginx Support Compress The Request To The Upstream?

    Answer :

    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.

  37. Biztalk Server Interview Questions

  38. Question 24. Explain How You Can Get The Current Time In Nginx?

    Answer :

    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;

  39. Docker (software) Interview Questions

  40. Question 25. Explain How To Add Modules In Nginx Server?

    Answer :

    During the compilation process, Nginx modules must be selected as such runtime selection of modules is not supported by Nginx.

  41. Question 26. Explain How Nginx Can Handle Http Requests?

    Answer :

    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.

  42. Dns Server Interview Questions

  43. Question 27. In Nginx How You Can Prevent Processing Requests With Undefined Server Names?

    Answer :

    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.

  44. Amazon Web Services (AWS) Interview Questions

  45. Question 28. Define Some Special Features Of Nginx?

    Answer :

    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
  46. Question 29. What Is The Difference Between Nginx And Apache?

    Answer :

    Nginx :

    • 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 do not support O.S like IBMi and OpenVMS.
    • Nginx comes only with core features
    • Nginx performance and scalability do not depend on hardware

     Apache:

    • 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 application is based on Python or Ruby
    • Apache support much wider range of O.S
    • Apache provides lot more functionality than Nginx
    • Apache is dependent on hardware components like CPU and memory
  47. Unix/Linux Interview Questions

  48. Question 30. How To Reopening The Log Files In Nginx Server?

    Answer :

    You can use nginx –s reopen

  49. Question 31. How To Reload Configuration File Of Nginx Server?

    Answer :

    You can reload Nginx configuration file by running this command: nginx -­s reload