Created
January 5, 2024 16:17
-
-
Save bjornarhagen/513722d6a4fca192666c065ee257b36b to your computer and use it in GitHub Desktop.
nginx config for html/static
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes auto; | |
pid /var/run/nginx/nginx.pid; | |
error_log /var/log/nginx/error.log; | |
include /etc/nginx/modules-enabled/*.conf; | |
events { | |
worker_connections 768; | |
} | |
http { | |
sendfile on; | |
tcp_nopush on; | |
types_hash_max_size 2048; | |
keepalive_timeout 65; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
client_body_temp_path /tmp/client_temp; | |
proxy_temp_path /tmp/proxy_temp_path; | |
fastcgi_temp_path /tmp/fastcgi_temp; | |
uwsgi_temp_path /tmp/uwsgi_temp; | |
scgi_temp_path /tmp/scgi_temp; | |
map $sent_http_content_type $expires { | |
default off; | |
text/html epoch; | |
text/css max; | |
application/javascript max; | |
~image/ max; | |
~font/ max; | |
} | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE | |
ssl_prefer_server_ciphers on; | |
access_log /var/log/nginx/access.log; | |
gzip on; | |
gzip_http_version 1.1; | |
gzip_disable "MSIE [1-6]\."; | |
gzip_min_length 256; | |
gzip_vary on; | |
gzip_proxied expired no-cache no-store private auth; | |
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
gzip_comp_level 9; | |
server { | |
listen 8080 default_server; | |
listen [::]:8080 default_server; | |
server_name localhost; | |
root /usr/share/nginx/html/public; | |
index index.php index.html index.htm; | |
client_max_body_size 30m; | |
expires $expires; | |
location / { | |
try_files $uri $uri/ /index.html$is_args$args; | |
} | |
error_page 404 /404; | |
error_page 500 502 503 504 /50x; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment