Update server configs

Update some of the server configurations to match
the ones used in the Apache hypertext access file.
This commit is contained in:
alrra 2013-03-29 23:49:16 +02:00
parent adb6c7d926
commit a6bf5c3cd4
2 changed files with 120 additions and 80 deletions

View File

@ -1,31 +1,64 @@
types { types {
text/html html htm shtml;
text/css css;
text/cache-manifest manifest appcache;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
text/x-vcard vcf;
# JavaScript # Audio
application/javascript js jsonp; audio/midi mid midi kar;
application/json json; audio/mp4 aac f4a f4b m4a;
audio/mpeg mp3;
audio/ogg oga ogg;
audio/x-realaudio ra;
audio/x-wav wav;
# Images # Images
image/bmp bmp;
image/gif gif;
image/jpeg jpeg jpg;
image/png png; image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff; image/tiff tif tiff;
image/vnd.wap.wbmp wbmp; image/vnd.wap.wbmp wbmp;
image/webp webp; image/webp webp;
image/x-icon ico; image/x-icon ico;
image/x-jng jng; image/x-jng jng;
image/bmp bmp;
image/gif gif;
image/jpeg jpeg jpg;
application/xml rss atom xml rdf; # JavaScript
application/javascript js jsonp;
application/json json;
# Manifest files
application/x-web-app-manifest+json webapp;
text/cache-manifest manifest appcache;
# Microsoft Office
application/msword doc;
application/vnd.ms-excel xls;
application/vnd.ms-powerpoint ppt;
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
# Video
video/3gpp 3gpp 3gp;
video/mp4 mp4 m4v f4v f4p;
video/mpeg mpeg mpg;
video/ogg ogv;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
# Web feeds
application/xml atom rdf rss xml;
# Web fonts
application/font-woff woff;
application/vnd.ms-fontobject eot;
application/x-font-ttf ttc ttf;
font/opentype otf;
image/svg+xml svg svgz;
# Other
application/java-archive jar war ear; application/java-archive jar war ear;
application/mac-binhex40 hqx; application/mac-binhex40 hqx;
application/pdf pdf; application/pdf pdf;
@ -61,38 +94,14 @@ types {
application/octet-stream msi msp msm; application/octet-stream msi msp msm;
application/octet-stream safariextz; application/octet-stream safariextz;
# Audio text/css css;
audio/midi mid midi kar; text/html html htm shtml;
audio/mpeg mp3; text/mathml mml;
audio/ogg oga ogg; text/plain txt;
audio/mp4 m4a f4a f4b aac; text/vnd.sun.j2me.app-descriptor jad;
audio/x-realaudio ra; text/vnd.wap.wml wml;
audio/x-wav wav; text/vtt vtt;
text/x-component htc;
text/x-vcard vcf;
# Video
video/3gpp 3gpp 3gp;
video/mp4 mp4 m4v f4v f4p;
video/mpeg mpeg mpg;
video/ogg ogv;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
# Webfonts
application/font-woff woff;
application/vnd.ms-fontobject eot;
application/x-font-ttf ttf ttc;
application/x-font-opentype otf;
# Microsoft Office
application/msword doc;
application/vnd.ms-excel xls;
application/vnd.ms-powerpoint ppt;
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
} }

View File

@ -1,11 +1,14 @@
# nginx Configuration File
# http://wiki.nginx.org/Configuration
# Run as a less privileged user for security reasons. # Run as a less privileged user for security reasons.
user www www; user www www;
# How many worker threads to run; "auto" sets it to the number # How many worker threads to run;
# of CPU cores available in the system, and offers the best # "auto" sets it to the number of CPU cores available in the system, and
# performance. Don't set it higher than the number of CPU cores # offers the best performance. Don't set it higher than the number of CPU
# if changing this parameter. # cores if changing this parameter.
#
# The maximum number of connections for Nginx is calculated by: # The maximum number of connections for Nginx is calculated by:
# max_clients = worker_processes * worker_connections # max_clients = worker_processes * worker_connections
worker_processes auto; worker_processes auto;
@ -15,21 +18,23 @@ worker_processes auto;
worker_rlimit_nofile 8192; worker_rlimit_nofile 8192;
events { events {
# When you need > 8000 * cpu_cores connections, you start optimizing # When you need > 8000 * cpu_cores connections, you start optimizing your OS,
# your OS, and this is probably the point at where you hire people # and this is probably the point at where you hire people who are smarter than
# who are smarter than you, as this is *a lot* of requests. # you, as this is *a lot* of requests.
worker_connections 8000; worker_connections 8000;
} }
# Default error log file (this is only used when you don't override error_log on a server{} level) # Default error log file
# (this is only used when you don't override error_log on a server{} level)
error_log logs/error.log warn; error_log logs/error.log warn;
pid /var/run/nginx.pid; pid /var/run/nginx.pid;
http { http {
# Hide nginx version information. # Hide nginx version information.
server_tokens off; server_tokens off;
# Define the mime types for files. # Define the MIME types for files.
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
@ -38,7 +43,8 @@ http {
'"$request" $body_bytes_sent "$http_referer" ' '"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; '"$http_user_agent" "$http_x_forwarded_for"';
# Default log file (this is only used when you don't override access_log on a server{} level) # Default log file
# (this is only used when you don't override access_log on a server{} level)
access_log logs/access.log main; access_log logs/access.log main;
# How long to allow each connection to stay idle; longer values are better # How long to allow each connection to stay idle; longer values are better
@ -59,30 +65,55 @@ http {
# bandwidth at the cost of a nearly imperceptible increase to latency. (removes TCP_NODELAY) # bandwidth at the cost of a nearly imperceptible increase to latency. (removes TCP_NODELAY)
tcp_nodelay off; tcp_nodelay off;
# Enable Gzip compressed responses from the server to massively speed up
# resource transfer times, especially for clients on slow connections. # Compression
# All browsers since ~1998 support Gzip compression.
# Enable Gzip compressed.
gzip on; gzip on;
gzip_http_version 1.0; # enable compression both for HTTP/1.0 and HTTP/1.1, required for CloudFront
gzip_disable "msie6"; # disable gzipping for ie 5.5 and ie 6 # Enable compression both for HTTP/1.0 and HTTP/1.1 (required for CloudFront).
gzip_comp_level 5; # level is from 1-9; 5 is a perfect compromise between size and cpu usage, offering about 75% reduction for most ascii files (almost identical to level 9) gzip_http_version 1.0;
gzip_min_length 256; # don't compress anything that's already tiny and unlikely to shrink much if at all (the default is 20 bytes, which is bad as that usually leads to larger files after gzipping)
gzip_proxied any; # compress data even for clients that are connecting to us via proxies (identified by the "Via" header), required for CloudFront # Compression level (1-9).
gzip_vary on; # tells proxies to cache both the gzipped and regular version of a resource whenever the client's Accept-Encoding capabilities header varies; avoids the issue where a non-gzip capable client (which is extremely rare today) would display gibberish if their proxy gave them the gzipped version # 5 is a perfect compromise between size and cpu usage, offering about
# 75% reduction for most ascii files (almost identical to level 9).
gzip_comp_level 5;
# Don't compress anything that's already small and unlikely to shrink much
# if at all (the default is 20 bytes, which is bad as that usually leads to
# larger files after gzipping).
gzip_min_length 256;
# Compress data even for clients that are connecting to us via proxies,
# identified by the "Via" header (required for CloudFront).
gzip_proxied any;
# Tell proxies to cache both the gzipped and regular version of a resource
# whenever the client's Accept-Encoding capabilities header varies;
# Avoids the issue where a non-gzip capable client (which is extremely rare
# today) would display gibberish if their proxy gave them the gzipped version.
gzip_vary on;
# Compress all output labeled with one of the following MIME-types.
gzip_types gzip_types
# text/html is always compressed by HttpGzipModule application/atom+xml
text/css
text/plain
text/x-component
application/javascript application/javascript
application/json application/json
application/xml application/rss+xml
application/xhtml+xml
application/x-font-ttf
application/x-font-opentype
application/vnd.ms-fontobject application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml image/svg+xml
image/x-icon; image/x-icon
text/css
text/html
text/plain
text/x-component;
# text/html is always compressed by HttpGzipModule
# This should be turned on if you are going to have pre-compressed copies (.gz) of # 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 # static files available. If not it should be left off as it will cause extra I/O