mirror of
https://github.com/coollabsio/coolify-docs.git
synced 2026-06-19 07:35:55 +00:00
88 lines
2.4 KiB
Nginx Configuration File
88 lines
2.4 KiB
Nginx Configuration File
worker_processes auto;
|
|
|
|
# default NGINX PID has been moved to /tmp/nginx.pid on unprivileged nginx
|
|
pid /tmp/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
# Basic optimizations
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
keepalive_timeout 65;
|
|
client_max_body_size 1m;
|
|
|
|
# Disable server tokens
|
|
server_tokens off;
|
|
|
|
# Server block
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
absolute_redirect off;
|
|
root /usr/share/nginx/html;
|
|
|
|
# # Static files handling
|
|
# location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
# expires 7d;
|
|
# add_header Cache-Control "public, no-transform";
|
|
# }
|
|
|
|
include /etc/nginx/conf.d/redirects.conf;
|
|
|
|
# Keep missing static assets as real 404s instead of redirecting them to the docs home.
|
|
# The generated app emits page files at the web root while public assets are served under /docs.
|
|
location ~* ^/docs/(.+\.(?:avif|css|gif|ico|jpe?g|js|json|map|png|svg|ttf|txt|webmanifest|webp|woff2?|xml))$ {
|
|
try_files $uri /$1 =404;
|
|
}
|
|
|
|
location ~* \.(?:avif|css|gif|ico|jpe?g|js|json|map|png|svg|ttf|txt|webmanifest|webp|woff2?|xml)$ {
|
|
try_files $uri =404;
|
|
}
|
|
|
|
location = /docs {
|
|
try_files /docs/index.html /index.html @docs_soft_404;
|
|
}
|
|
|
|
location = /docs/ {
|
|
try_files /docs/index.html /index.html @docs_soft_404;
|
|
}
|
|
|
|
location ~ ^/docs/(.+)$ {
|
|
index index.html;
|
|
try_files $uri/index.html $uri.html $uri /$1/index.html /$1.html /$1 @docs_soft_404;
|
|
}
|
|
|
|
location / {
|
|
index index.html;
|
|
# # Add rewrite rule to handle URLs without trailing slash
|
|
# rewrite ^([^.]*[^/])$ $1/ permanent;
|
|
try_files $uri/index.html $uri.html $uri @docs_soft_404;
|
|
}
|
|
|
|
location @docs_soft_404 {
|
|
return 302 /docs;
|
|
}
|
|
|
|
# a folder without index.html raises 403 in this setup
|
|
error_page 403 =302 /docs;
|
|
location = /favicon.ico {
|
|
rewrite ^/favicon.ico$ /docs/brand/favicon.ico;
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
|
|
# Deny access to hidden files
|
|
location ~ /\. {
|
|
deny all;
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
}
|
|
}
|