Unverified Commit dffafdec authored by Shunya Hayashi's avatar Shunya Hayashi Committed by GitHub

Update nginx.conf example in documentation for improved flexibility and clarity (#53135)

## Description

This PR updates the provided example of nginx.conf in the documentation. The changes introduce more flexibility and clarity, making the example easier to understand and more suited for general use.

## What?

Changes include ↓

- Modifying the root directory to `/var/www/out`. This aligns more closely with typical server configurations and separates the public web content from other parts of the server.

- Updating the try_files directive for the `/` location block. The directive now attempts to serve `$uri`, `$uri.html`, and `$uri/` in that order. This setup caters to the common pattern in static websites of serving files derived directly from the URL and correctly handles URLs that omit the .html extension.

- The `/blog/` location block is retained as is, with the rewrite directive still relevant and not requiring changes.

## Why?

These modifications aim to improve the applicability of the example to a wider range of use cases and make it more comprehensible for new users.

## How?

The changes were made directly to the `nginx.conf` example provided in the docs, following the standard syntax and conventions of Nginx configuration files.


Please let me know if there are any questions, or if further modifications are needed !!
Co-authored-by: 's avatarJJ Kasper <22380829+ijjk@users.noreply.github.com>
parent 5bccef85
......@@ -338,17 +338,17 @@ server {
listen 80;
server_name acme.com;
root /var/www;
root /var/www/out;
location / {
try_files /out/index.html =404;
try_files $uri $uri.html $uri/ =404;
}
location /blog/ {
rewrite ^/blog/(.*)$ /out/blog/$1.html break;
rewrite ^/blog/(.*)$ /blog/$1.html break;
}
error_page 404 /out/404.html;
error_page 404 /404.html;
location = /404.html {
internal;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment