User Tools

Site Tools


nginxarchitecture

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
nginxarchitecture [2024/10/27 02:01] – [Optimize nginx configuration for performance and benchmark] adminnginxarchitecture [2024/10/27 02:55] (current) – [Basic Nginx Configuration] admin
Line 27: Line 27:
   * The performance and scalability of Nginx is not completely dependent on hardware resources, whereas the performance and scalability of the Apache is dependent on underlying hardware resources like memory and CPU.   * The performance and scalability of Nginx is not completely dependent on hardware resources, whereas the performance and scalability of the Apache is dependent on underlying hardware resources like memory and CPU.
 ===== Basic Nginx Configuration ===== ===== Basic Nginx Configuration =====
-refer: https://docs.nginx.com/nginx/admin-guide/basic-functionality/managing-configuration-files/ +Some basic directives: 
-<code>+  * Location (refer: https://docs.nginx.com/nginx/admin-guide/basic-functionality/managing-configuration-files/)<code ini>
 user nobody; # a directive in the 'main' context user nobody; # a directive in the 'main' context
  
Line 59: Line 59:
     }     }
 } }
 +</code>
 +  * request_filename (refer: https://docs.nginx.com/nginx/admin-guide/web-server/web-server/)<code>
 +if (!-e $request_filename) { rewrite ^ /path/index.php last; }
 +</code> => This checks whether there is a file, directory, or symbolic link that **matches the $request_filename**. If such a file is **not found**, the connection is being **redirected to /path/index.php**.
 +  * try_files (refer https://docs.nginx.com/nginx/admin-guide/web-server/serving-static-content/)<code>
 +location / {
 +    try_files $uri $uri/ $uri.html =404;
 +}
 +</code><code>
 +location / {
 +    try_files $uri $uri/ /test/index.html;
 +}
 +</code> => you probably understand:<code>
 +location / => matches all locations**
 +try_files $uri =>try $uri first, for example http://example.com/images/image.jpg nginx will try to check if there's a file inside /images called image.jpg if found it will serve it first.
 +$uri/=> which means if you didn't find the first condition $uri try the URI as a directory
 </code> </code>
 ===== Optimize nginx configuration for performance and benchmark ===== ===== Optimize nginx configuration for performance and benchmark =====
nginxarchitecture.1729994485.txt.gz · Last modified: 2024/10/27 02:01 by admin