Nginx Web Server Configuration Flashcards

(25 cards)

1
Q

What is Nginx in the context of web servers?

A

Nginx is a high-performance web server that serves HTTP requests for PHP and WordPress applications.

Nginx is known for its speed and efficiency, often used as an alternative to Apache in LAMP-like stacks (e.g., LEMP: Linux, Nginx, MySQL, PHP). For WordPress, it serves static and dynamic content. Freelancers configure Nginx for client sites, while enterprise architects leverage its scalability for high-traffic systems, aligning with your LAMP stack interest.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the main Nginx configuration file?

A

The main configuration file is nginx.conf, typically located in /etc/nginx.

nginx.conf defines global settings and includes other configs. In WordPress, it sets up the server for site hosting. Freelancers edit it for basic setups, while enterprise architects manage it for multi-site environments, similar to Apache’s httpd.conf.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a server block in Nginx?

A

A server block defines a virtual server for a website, like server { listen 80; server_name example.com; }.

Equivalent to Apache’s virtual hosts, server blocks handle WordPress sites. Freelancers configure server blocks for clients, while enterprise architects automate them for load-balanced systems, building on your Apache virtual host knowledge.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you define a server block in Nginx?

A

Use server {} in a configuration file, like server { listen 80; server_name example.com; root /var/www/html; }.

Specifies site settings. Freelancers set up WordPress server blocks, while enterprise architects configure multiple blocks for scalability, akin to Apache’s <VirtualHost>.</VirtualHost>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the listen directive in Nginx?

A

The listen directive specifies the port and IP, like listen 80; or listen 443 ssl;.

Defines where Nginx accepts requests. For WordPress, listen 80 handles HTTP. Freelancers configure ports, while enterprise architects use 443 for secure HTTPS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the server_name directive in Nginx?

A

The server_name directive sets the domain, like server_name example.com www.example.com;.

Identifies a WordPress site. Freelancers configure domains, while enterprise architects manage multiple domains for enterprise systems, similar to Apache’s ServerName.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the root directive in Nginx?

A

The root directive specifies the document root, like root /var/www/html;.

Points to WordPress’s file directory, like Apache’s DocumentRoot. Freelancers set it for client sites, while enterprise architects ensure secure paths.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the location block in Nginx?

A

A location block defines how to handle specific URIs, like location / { try_files $uri $uri/ /index.php?$args; }.

In WordPress, it routes requests for permalinks. Freelancers configure locations, while enterprise architects optimize routing for performance, aligning with your rewrite rule experience.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the try_files directive in Nginx?

A

The try_files directive checks for files or falls back, like try_files $uri $uri/ /index.php?$args;.

Ensures WordPress permalinks work by passing requests to index.php. Freelancers enable clean URLs, while enterprise architects streamline fallbacks, similar to Apache’s mod_rewrite.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the fastcgi_pass directive?

A

The fastcgi_pass directive forwards PHP requests to a FastCGI server, like fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;.

In WordPress, it processes PHP with PHP-FPM. Freelancers configure FastCGI, while enterprise architects optimize socket connections for performance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is PHP-FPM in Nginx?

A

PHP-FPM (FastCGI Process Manager) handles PHP processing for Nginx.

Unlike Apache’s mod_php, PHP-FPM runs PHP separately, serving WordPress dynamic content. Freelancers set up PHP-FPM, while enterprise architects scale it for high loads, building on your PHP knowledge.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you configure Nginx for WordPress permalinks?

A

Use a location block with try_files, like location / { try_files $uri $uri/ /index.php?$args; }.

Routes requests to WordPress’s index.php. Freelancers enable permalinks, while enterprise architects ensure efficient routing, akin to Apache’s .htaccess rewrites.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the include directive in Nginx?

A

The include directive imports external configuration files, like include /etc/nginx/conf.d/*.conf;.

Simplifies managing WordPress server blocks. Freelancers include site configs, while enterprise architects organize configs for modularity, similar to Apache includes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the access_log directive?

A

The access_log directive specifies the access log file, like access_log /var/log/nginx/access.log;.

Tracks WordPress site visits. Freelancers monitor traffic, while enterprise architects integrate logs with analytics, per your debugging interests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the error_log directive?

A

The error_log directive defines the error log file, like error_log /var/log/nginx/error.log;.

Logs WordPress server errors. Freelancers debug issues, while enterprise architects use logs for monitoring, aligning with your error handling deck.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the ssl directive in Nginx?

A

The ssl directive enables HTTPS, like listen 443 ssl; ssl on;.

Secures WordPress with TLS. Freelancers enable SSL, while enterprise architects configure it for compliance, as in your WordPress Security deck.

17
Q

What is the ssl_certificate directive?

A

The ssl_certificate directive specifies the SSL certificate, like ssl_certificate /etc/ssl/certs/cert.pem;.

Enables HTTPS for WordPress. Freelancers use Let’s Encrypt, while enterprise architects manage certificate chains, similar to Apache’s SSLCertificateFile.

18
Q

What is the ssl_certificate_key directive?

A

The ssl_certificate_key directive specifies the private key, like ssl_certificate_key /etc/ssl/private/key.pem;.

Pairs with the certificate for HTTPS. Freelancers secure WordPress, while enterprise architects automate key management.

19
Q

What is the gzip directive in Nginx?

A

The gzip directive enables compression, like gzip on;.

Reduces WordPress page size for faster loading. Freelancers enable compression, while enterprise architects optimize gzip settings, per your performance deck.

20
Q

What is the client_max_body_size directive?

A

The client_max_body_size directive sets the maximum upload size, like client_max_body_size 64M;.

Allows larger WordPress media uploads. Freelancers configure it for clients, while enterprise architects balance size limits with security.

21
Q

What is the server_tokens directive?

A

The server_tokens directive controls Nginx version disclosure, like server_tokens off;.

Hides version for security, like Apache’s ServerTokens. Freelancers minimize exposure, while enterprise architects enforce it to reduce attack surfaces, per your security deck.

22
Q

What is the limit_req directive?

A

The limit_req directive restricts request rates, like limit_req zone=mylimit burst=20;.

Protects WordPress from DDoS attacks. Freelancers enable rate limiting, while enterprise architects fine-tune it for high-traffic systems.

23
Q

How do you reload Nginx configurations?

A

Use sudo nginx -s reload or sudo systemctl reload nginx.

Applies changes without downtime. Freelancers reload after edits, while enterprise architects automate reloads, similar to Apache’s restart.

24
Q

What is the nginx -t command?

A

The nginx -t command tests configuration syntax, like sudo nginx -t.

Ensures valid WordPress configs. Freelancers verify changes, while enterprise architects include it in deployment pipelines, aligning with your debugging goals.

25
What is a reverse proxy in Nginx?
A reverse proxy forwards requests to another server, like proxy_pass http://backend;. Used for load balancing WordPress. Freelancers set up proxies for performance, while enterprise architects configure proxies for scalable architectures, supporting your enterprise goals.