Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deployment guide for NGINX #10872

Open
2 tasks done
rawsashimi1604 opened this issue Jan 27, 2025 · 4 comments
Open
2 tasks done

Add deployment guide for NGINX #10872

rawsashimi1604 opened this issue Jan 27, 2025 · 4 comments
Labels
documentation The issue is related to the documentation of Docusaurus

Comments

@rawsashimi1604
Copy link

Have you read the Contributing Guidelines on issues?

Description

Hey all, feel like we could enhance the Deployment docs by providing a quick getting started guide on hosting docusaurus static build files via a dockerised NGINX. Would be willing to write a quick guide!

Self-service

  • I'd be willing to address this documentation request myself.
@rawsashimi1604 rawsashimi1604 added documentation The issue is related to the documentation of Docusaurus status: needs triage This issue has not been triaged by maintainers labels Jan 27, 2025
@rawsashimi1604 rawsashimi1604 changed the title Add deployment guide to NGINX Add deployment guide for NGINX Jan 27, 2025
@slorber
Copy link
Collaborator

slorber commented Jan 27, 2025

Hi

Honestly I'd prefer to not add this guide to our official docs, and would prefer if it was an external resource we simply link to.

The reason is: I don't have the skills to maintain it. Introducing it means that it's now my responsibility to ensure this "official" guide remains up to date over time and for all the upcoming versions of Nginx.

There's an infinite number of ways to host static websites, using various software. We can't document them all officially: we count on our community for that.

@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Jan 27, 2025
@tats-u
Copy link
Contributor

tats-u commented Feb 2, 2025

The important things to host a website built by Docusaurus by Nginx/Apache are:

  • How to add/remove a/the trailing slash in the URL
  • How long and which directories should be cached

I think the former is stable, and the latter can be shared with Apache.

@tats-u
Copy link
Contributor

tats-u commented Feb 2, 2025

The latter:

  • /static/: several weeks?
  • /assets/: maybe immutable can be added to Cache-Control. Several months–half or one year?

I think an official guideline for them would be appreciated.

@jozefRudy
Copy link

jozefRudy commented Feb 26, 2025

I would also appreciate official guide to caching in nginx mentioned by @tats-u , it would be immensely helpful.

my hypothesis here is this, feedback welcome, so that we can arrive at idiomatic configuration in nginx for file /etc/nginx/conf.d/default.conf is this:

server {
    listen 80;
    index index.html;
    root /var/www/html;
    
    location ~* \.html$ {
        add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always;
    }
    
    # /static/ directory - medium-term caching
    location /static/ {
        expires 4w;
        add_header Cache-Control "public, max-age=2419200";
        try_files $uri =404;
    }
    
    # All other static assets - long-term caching
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|ttf|eot|webp)$ {
        expires 1y;
        add_header Cache-Control "public, max-age=31536000, immutable";
        try_files $uri =404;
    }

    
    location / {
        try_files $uri $uri/index.html $uri/ =404;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation The issue is related to the documentation of Docusaurus
Projects
None yet
Development

No branches or pull requests

4 participants