Skip to content

Instantly share code, notes, and snippets.

@dimitardanailov
Last active June 3, 2021 17:30
Show Gist options
  • Save dimitardanailov/7a7c4e3be9e03d1b578a to your computer and use it in GitHub Desktop.
Save dimitardanailov/7a7c4e3be9e03d1b578a to your computer and use it in GitHub Desktop.
Configuration for single page application(Framework: Angularjs, Web server: Nginx)
server {
listen 80 default deferred;
server_name myapp.com;
root /var/www/project-folder/;
# Nginx and Angularjs with html mode 5 - https://gist.github.com/cjus/b46a243ba610661a7efb
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
# Location of asset folder
location ~ ^/(assets)/ {
gzip_static on;
gzip_types text/plain text/xml text/css
text/comma-separated-values
text/javascript application/x-javascript
application/atom+xml;
expires max;
}
# Defines the URI that will be shown for the specified errors.
# error_page directives are inherited from the previous level
# only if there are no error_page directives defined on the current level.
# A uri value can contain variables.
error_page 404 /404.html;
# Sets the maximum allowed size of the client request body,
# specified in the “Content-Length” request header field.
# If the size in a request exceeds the configured value,
# the 413 (Request Entity Too Large) error is returned to the client.
# Please be aware that browsers cannot correctly display this error.
# Setting size to 0 disables checking of client request body size.
client_max_body_size 4G;
# The first parameter sets a timeout during which a keep-alive
# client connection will stay open on the server side.
# The zero value disables keep-alive client connections.
# The optional second parameter sets a value in the “Keep-Alive: timeout=time” response header field.
# Two parameters may differ.
keepalive_timeout 10;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment