This repository has been archived by the owner on Jan 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Oops. 404 and 500 error pages need to be located in the templates dir…
…ectory. Also, convert nginx.conf to unix line endings.
- Loading branch information
Showing
3 changed files
with
166 additions
and
166 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,166 +1,166 @@ | ||
# Set another default user than root for security reasons | ||
user www-data www-data; | ||
|
||
# As a thumb rule: One per CPU. If you are serving a large amount | ||
# of static files, which requires blocking disk reads, you may want | ||
# to increase this from the number of cpu_cores available on your | ||
# system. | ||
# | ||
# The maximum number of connections for Nginx is calculated by: | ||
# max_clients = worker_processes * worker_connections | ||
worker_processes 1; | ||
|
||
# Maximum file descriptors that can be opened per process | ||
# This should be > worker_connections | ||
worker_rlimit_nofile 8192; | ||
|
||
events { | ||
# When you need > 8000 * cpu_cores connections, you start optimizing | ||
# your OS, and this is probably the point at where you hire people | ||
# who are smarter than you, this is *a lot* of requests. | ||
worker_connections 8000; | ||
} | ||
|
||
# Change these paths to somewhere that suits you! | ||
error_log logs/error.log; | ||
pid logs/nginx.pid; | ||
|
||
http { | ||
# Set the mime-types via the mime.types external file | ||
include nginx-mime.types; | ||
|
||
# And the fallback mime-type | ||
default_type application/octet-stream; | ||
|
||
# Format for our log files | ||
log_format main '$remote_addr - $remote_user [$time_local] $status ' | ||
'"$request" $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
# Click tracking! | ||
access_log logs/access.log main; | ||
|
||
# ~2 seconds is often enough for HTML/CSS, but connections in | ||
# Nginx are cheap, so generally it's safe to increase it | ||
keepalive_timeout 20; | ||
|
||
# You usually want to serve static files with Nginx | ||
sendfile on; | ||
|
||
tcp_nopush on; # off may be better for Comet/long-poll stuff | ||
tcp_nodelay off; # on may be better for Comet/long-poll stuff | ||
|
||
# Enable Gzip: | ||
gzip on; | ||
gzip_http_version 1.0; | ||
gzip_comp_level 5; | ||
gzip_min_length 512; | ||
gzip_buffers 4 8k; | ||
gzip_proxied any; | ||
gzip_types | ||
# text/html is always compressed by HttpGzipModule | ||
text/css | ||
text/javascript | ||
text/xml | ||
text/plain | ||
text/x-component | ||
application/javascript | ||
application/x-javascript | ||
application/json | ||
application/xml | ||
application/rss+xml | ||
font/truetype | ||
font/opentype | ||
application/vnd.ms-fontobject | ||
image/svg+xml; | ||
|
||
# This should be turned on if you are going to have pre-compressed copies (.gz) of | ||
# static files available. If not it should be left off as it will cause extra I/O | ||
# for the check. It would be better to enable this in a location {} block for | ||
# a specific directory: | ||
# gzip_static on; | ||
|
||
gzip_disable "MSIE [1-6]\."; | ||
gzip_vary on; | ||
|
||
server { | ||
# listen 80 default_server deferred; # for Linux | ||
# listen 80 default_server accept_filter=httpready; # for FreeBSD | ||
listen 80 default_server; | ||
|
||
# e.g. "localhost" to accept all connections, or "www.example.com" | ||
# to handle the requests for "example.com" (and www.example.com) | ||
# server_name www.example.com; | ||
|
||
# Path for static files | ||
root /sites/example.com/public; | ||
|
||
#Specify a charset | ||
charset utf-8; | ||
|
||
# Custom 404 page | ||
error_page 404 /static/404.html; | ||
|
||
# Custom 500 page | ||
error_page 500 /static/500.html; | ||
|
||
# No default expire rule. This config mirrors that of apache as outlined in the | ||
# html5-boilerplate .htaccess file. However, nginx applies rules by location, the apache rules | ||
# are defined by type. A concequence of this difference is that if you use no file extension in | ||
# the url and serve html, with apache you get an expire time of 0s, with nginx you'd get an | ||
# expire header of one month in the future (if the default expire rule is 1 month). | ||
# Therefore, do not use a default expire rule with nginx unless your site is completely static | ||
|
||
# cache.appcache, your document html and data | ||
location ~* \.(?:manifest|appcache|html|xml|json)$ { | ||
expires -1; | ||
access_log logs/static.log; | ||
} | ||
|
||
# Feed | ||
location ~* \.(?:rss|atom)$ { | ||
expires 1h; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
# Favicon | ||
location ~* \.ico$ { | ||
expires 1w; | ||
access_log off; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
# Media: images, video, audio, HTC, WebFonts | ||
location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ { | ||
expires 1M; | ||
access_log off; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
# CSS and Javascript | ||
location ~* \.(?:css|js)$ { | ||
expires 1y; | ||
access_log off; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
location /static | ||
alias $PROJECT_ROOT/static/; | ||
} | ||
|
||
location /media | ||
alias $PROJECT_ROOT/media/; | ||
} | ||
|
||
# uWSGI configuration | ||
# location / { | ||
# uwsgi_pass unix:///var/run/$PROJECT_NAME.sock; | ||
# include uwsgi_params; | ||
# } | ||
|
||
# opt-in to the future | ||
add_header "X-UA-Compatible" "IE=Edge,chrome=1"; | ||
|
||
} | ||
} | ||
|
||
# Set another default user than root for security reasons | ||
user www-data www-data; | ||
|
||
# As a thumb rule: One per CPU. If you are serving a large amount | ||
# of static files, which requires blocking disk reads, you may want | ||
# to increase this from the number of cpu_cores available on your | ||
# system. | ||
# | ||
# The maximum number of connections for Nginx is calculated by: | ||
# max_clients = worker_processes * worker_connections | ||
worker_processes 1; | ||
|
||
# Maximum file descriptors that can be opened per process | ||
# This should be > worker_connections | ||
worker_rlimit_nofile 8192; | ||
|
||
events { | ||
# When you need > 8000 * cpu_cores connections, you start optimizing | ||
# your OS, and this is probably the point at where you hire people | ||
# who are smarter than you, this is *a lot* of requests. | ||
worker_connections 8000; | ||
} | ||
|
||
# Change these paths to somewhere that suits you! | ||
error_log logs/error.log; | ||
pid logs/nginx.pid; | ||
|
||
http { | ||
# Set the mime-types via the mime.types external file | ||
include nginx-mime.types; | ||
|
||
# And the fallback mime-type | ||
default_type application/octet-stream; | ||
|
||
# Format for our log files | ||
log_format main '$remote_addr - $remote_user [$time_local] $status ' | ||
'"$request" $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
# Click tracking! | ||
access_log logs/access.log main; | ||
|
||
# ~2 seconds is often enough for HTML/CSS, but connections in | ||
# Nginx are cheap, so generally it's safe to increase it | ||
keepalive_timeout 20; | ||
|
||
# You usually want to serve static files with Nginx | ||
sendfile on; | ||
|
||
tcp_nopush on; # off may be better for Comet/long-poll stuff | ||
tcp_nodelay off; # on may be better for Comet/long-poll stuff | ||
|
||
# Enable Gzip: | ||
gzip on; | ||
gzip_http_version 1.0; | ||
gzip_comp_level 5; | ||
gzip_min_length 512; | ||
gzip_buffers 4 8k; | ||
gzip_proxied any; | ||
gzip_types | ||
# text/html is always compressed by HttpGzipModule | ||
text/css | ||
text/javascript | ||
text/xml | ||
text/plain | ||
text/x-component | ||
application/javascript | ||
application/x-javascript | ||
application/json | ||
application/xml | ||
application/rss+xml | ||
font/truetype | ||
font/opentype | ||
application/vnd.ms-fontobject | ||
image/svg+xml; | ||
|
||
# This should be turned on if you are going to have pre-compressed copies (.gz) of | ||
# static files available. If not it should be left off as it will cause extra I/O | ||
# for the check. It would be better to enable this in a location {} block for | ||
# a specific directory: | ||
# gzip_static on; | ||
|
||
gzip_disable "MSIE [1-6]\."; | ||
gzip_vary on; | ||
|
||
server { | ||
# listen 80 default_server deferred; # for Linux | ||
# listen 80 default_server accept_filter=httpready; # for FreeBSD | ||
listen 80 default_server; | ||
|
||
# e.g. "localhost" to accept all connections, or "www.example.com" | ||
# to handle the requests for "example.com" (and www.example.com) | ||
# server_name www.example.com; | ||
|
||
# Path for static files | ||
root /sites/example.com/public; | ||
|
||
#Specify a charset | ||
charset utf-8; | ||
|
||
# Custom 404 page | ||
error_page 404 /404.html; | ||
|
||
# Custom 500 page | ||
error_page 500 /500.html; | ||
|
||
# No default expire rule. This config mirrors that of apache as outlined in the | ||
# html5-boilerplate .htaccess file. However, nginx applies rules by location, the apache rules | ||
# are defined by type. A concequence of this difference is that if you use no file extension in | ||
# the url and serve html, with apache you get an expire time of 0s, with nginx you'd get an | ||
# expire header of one month in the future (if the default expire rule is 1 month). | ||
# Therefore, do not use a default expire rule with nginx unless your site is completely static | ||
|
||
# cache.appcache, your document html and data | ||
location ~* \.(?:manifest|appcache|html|xml|json)$ { | ||
expires -1; | ||
access_log logs/static.log; | ||
} | ||
|
||
# Feed | ||
location ~* \.(?:rss|atom)$ { | ||
expires 1h; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
# Favicon | ||
location ~* \.ico$ { | ||
expires 1w; | ||
access_log off; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
# Media: images, video, audio, HTC, WebFonts | ||
location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ { | ||
expires 1M; | ||
access_log off; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
# CSS and Javascript | ||
location ~* \.(?:css|js)$ { | ||
expires 1y; | ||
access_log off; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
location /static | ||
alias $PROJECT_ROOT/static/; | ||
} | ||
|
||
location /media | ||
alias $PROJECT_ROOT/media/; | ||
} | ||
|
||
# uWSGI configuration | ||
# location / { | ||
# uwsgi_pass unix:///var/run/$PROJECT_NAME.sock; | ||
# include uwsgi_params; | ||
# } | ||
|
||
# opt-in to the future | ||
add_header "X-UA-Compatible" "IE=Edge,chrome=1"; | ||
|
||
} | ||
} | ||
|
File renamed without changes.
File renamed without changes.