Permalink
Browse files

Initial Commit

  • Loading branch information...
0 parents commit ecbfeaff7129231bd500409e62fbe463eec307c4 @rajibmp committed Dec 13, 2012
@@ -0,0 +1,6 @@
+This Nginx Configuration is Tested with:
+
+CPU: Intel Pentium Dual Core 1.86 GHz
+RAM: 3 GB DDR
+HD: Enough to Run Drupal, HDD
+OS: Linux 3.5 Generic, Kubuntu
@@ -0,0 +1,5 @@
+1. This Configuration doesn't Guarantee that it will work in your setup. If contacted for some help for configuration then I may probably help during my free time.
+
+2. This Configuration only targeted for PHP Web Application Development.
+
+3. You are free to use this and distribute. If you charge your customer while using this setup then please feel free to Buy Me a Mug of Beer.
@@ -0,0 +1,9 @@
+Sorry for the Misleading Title. The title should actually be Best Nginx Configuration for PHP Web Application development. Since the title would be too long I just shortened it in this way.
+
+There is nothing called best in this world, it depends on individual person how good they feel about something, likewise, this nginx configuration is what I have in my development machine when I develop PHP applications. I do this way just because I feel lazy to create new Virtual Host for every project, since most of the settings would be same, I thought of making one default configuration file which can serve all of my applications in project folder. This is the reason I would not recommend this settings in Production, Its only for development purpose.
+
+I tried hard to squeeze Nginx to make it more optimized, but the fact is nginx is already a light and highly optimized server, so, there are not much things to optimize.
+
+The configuration looks bit weird as all the files are separated from one another, but this is how I test my configurations, so, I can just add files and comment out the lines that I don't need, this how it'd make me easier to change from one configuration to another for testing.
+
+I will later explain the configuration in details in my Blog.
@@ -0,0 +1,3 @@
+This Configuration is Tested with
+
+MySQL Version: 5.5.28
@@ -0,0 +1,38 @@
+This Configuration is Tested with
+
+Nginx Version: nginx/1.2.1
+
+Loaded Modules/Flags:
+
+--prefix=/etc/nginx
+--conf-path=/etc/nginx/nginx.conf
+--error-log-path=/var/log/nginx/error.log
+--http-client-body-temp-path=/var/lib/nginx/body
+--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
+--http-log-path=/var/log/nginx/access.log
+--http-proxy-temp-path=/var/lib/nginx/proxy
+--http-scgi-temp-path=/var/lib/nginx/scgi
+--http-uwsgi-temp-path=/var/lib/nginx/uwsgi
+--lock-path=/var/lock/nginx.lock
+--pid-path=/var/run/nginx.pid
+--with-pcre-jit
+--with-debug
+--with-http_addition_module
+--with-http_dav_module
+--with-http_geoip_module
+--with-http_gzip_static_module
+--with-http_image_filter_module
+--with-http_realip_module
+--with-http_stub_status_module
+--with-http_ssl_module
+--with-http_sub_module
+--with-http_xslt_module
+--with-ipv6
+--with-sha1=/usr/include/openssl
+--with-md5=/usr/include/openssl
+--with-mail
+--with-mail_ssl_module
+--add-module=/build/buildd/nginx-1.2.1/debian/modules/nginx-auth-pam
+--add-module=/build/buildd/nginx-1.2.1/debian/modules/nginx-echo
+--add-module=/build/buildd/nginx-1.2.1/debian/modules/nginx-upstream-fair
+--add-module=/build/buildd/nginx-1.2.1/debian/modules/nginx-dav-ext-module
@@ -0,0 +1,18 @@
+##
+# Nginx Basic Settings
+##
+
+sendfile on;
+tcp_nopush on;
+tcp_nodelay on;
+keepalive_timeout 10;
+types_hash_max_size 2048;
+# server_tokens on;
+server_tokens on;
+
+# server_names_hash_bucket_size 64;
+server_names_hash_bucket_size 64;
+
+# Mime types
+include mime.types;
+default_type application/octet-stream;
@@ -0,0 +1,15 @@
+## Timeouts.
+client_body_timeout 60;
+client_header_timeout 60;
+keepalive_timeout 10 10;
+send_timeout 60;
+
+## Body Size
+client_max_body_size 128M;
+
+## Reset lingering timed out connections. Deflect DDoS.
+reset_timedout_connection on;
+
+## Buffer Size
+client_header_buffer_size 1k;
+large_client_header_buffers 4 4k;
@@ -0,0 +1,18 @@
+<html>
+<head>
+<title>The page is temporarily unavailable</title>
+<style>
+body { font-family: Tahoma, Verdana, Arial, sans-serif; }
+</style>
+</head>
+<body bgcolor="white" text="black">
+<table width="100%" height="100%">
+<tr>
+<td align="center" valign="middle">
+The page you are looking for is temporarily unavailable.<br/>
+Please try again later.
+</td>
+</tr>
+</table>
+</body>
+</html>
@@ -0,0 +1,13 @@
+# Bypass cache if flag is set
+ fastcgi_no_cache $no_cache;
+ fastcgi_cache_bypass $no_cache;
+ fastcgi_cache microcache;
+ fastcgi_cache_key $server_name|$request_uri;
+ fastcgi_cache_valid 404 30m;
+ fastcgi_cache_valid 200 10s;
+ fastcgi_max_temp_file_size 1M;
+ fastcgi_cache_use_stale updating;
+ fastcgi_pass_header Set-Cookie;
+ fastcgi_pass_header Cookie;
+ fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
+
@@ -0,0 +1,25 @@
+fastcgi_param QUERY_STRING $query_string;
+fastcgi_param REQUEST_METHOD $request_method;
+fastcgi_param CONTENT_TYPE $content_type;
+fastcgi_param CONTENT_LENGTH $content_length;
+
+fastcgi_param SCRIPT_FILENAME $request_filename;
+fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+fastcgi_param REQUEST_URI $request_uri;
+fastcgi_param DOCUMENT_URI $document_uri;
+fastcgi_param DOCUMENT_ROOT $document_root;
+fastcgi_param SERVER_PROTOCOL $server_protocol;
+
+fastcgi_param GATEWAY_INTERFACE CGI/1.1;
+fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
+
+fastcgi_param REMOTE_ADDR $remote_addr;
+fastcgi_param REMOTE_PORT $remote_port;
+fastcgi_param SERVER_ADDR $server_addr;
+fastcgi_param SERVER_PORT $server_port;
+fastcgi_param SERVER_NAME $server_name;
+
+fastcgi_param HTTPS $https;
+
+# PHP only, required if PHP was built with --enable-force-cgi-redirect
+fastcgi_param REDIRECT_STATUS 200;
@@ -0,0 +1,13 @@
+##
+# Gzip Settings
+##
+gzip on;
+gzip_buffers 16 8k;
+gzip_comp_level 9;
+gzip_http_version 1.1;
+gzip_min_length 10;
+gzip_types text/plain text/css image/png image/gif image/jpeg application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon;
+gzip_vary on;
+gzip_static on;
+gzip_proxied any;
+gzip_disable "MSIE [1-6]\.";
@@ -0,0 +1,108 @@
+# This map is not a full koi8-r <> utf8 map: it does not contain
+# box-drawing and some other characters. Besides this map contains
+# several koi8-u and Byelorussian letters which are not in koi8-r.
+# If you need a full and standard map, use contrib/unicode2nginx/koi-utf
+# map instead.
+
+charset_map koi8-r utf-8 {
+
+ 80 E282AC; # euro
+
+ 95 E280A2; # bullet
+
+ 9A C2A0; # &nbsp;
+
+ 9E C2B7; # &middot;
+
+ A3 D191; # small yo
+ A4 D194; # small Ukrainian ye
+
+ A6 D196; # small Ukrainian i
+ A7 D197; # small Ukrainian yi
+
+ AD D291; # small Ukrainian soft g
+ AE D19E; # small Byelorussian short u
+
+ B0 C2B0; # &deg;
+
+ B3 D081; # capital YO
+ B4 D084; # capital Ukrainian YE
+
+ B6 D086; # capital Ukrainian I
+ B7 D087; # capital Ukrainian YI
+
+ B9 E28496; # numero sign
+
+ BD D290; # capital Ukrainian soft G
+ BE D18E; # capital Byelorussian short U
+
+ BF C2A9; # (C)
+
+ C0 D18E; # small yu
+ C1 D0B0; # small a
+ C2 D0B1; # small b
+ C3 D186; # small ts
+ C4 D0B4; # small d
+ C5 D0B5; # small ye
+ C6 D184; # small f
+ C7 D0B3; # small g
+ C8 D185; # small kh
+ C9 D0B8; # small i
+ CA D0B9; # small j
+ CB D0BA; # small k
+ CC D0BB; # small l
+ CD D0BC; # small m
+ CE D0BD; # small n
+ CF D0BE; # small o
+
+ D0 D0BF; # small p
+ D1 D18F; # small ya
+ D2 D180; # small r
+ D3 D181; # small s
+ D4 D182; # small t
+ D5 D183; # small u
+ D6 D0B6; # small zh
+ D7 D0B2; # small v
+ D8 D18C; # small soft sign
+ D9 D18B; # small y
+ DA D0B7; # small z
+ DB D188; # small sh
+ DC D18D; # small e
+ DD D189; # small shch
+ DE D187; # small ch
+ DF D18A; # small hard sign
+
+ E0 D0AE; # capital YU
+ E1 D090; # capital A
+ E2 D091; # capital B
+ E3 D0A6; # capital TS
+ E4 D094; # capital D
+ E5 D095; # capital YE
+ E6 D0A4; # capital F
+ E7 D093; # capital G
+ E8 D0A5; # capital KH
+ E9 D098; # capital I
+ EA D099; # capital J
+ EB D09A; # capital K
+ EC D09B; # capital L
+ ED D09C; # capital M
+ EE D09D; # capital N
+ EF D09E; # capital O
+
+ F0 D09F; # capital P
+ F1 D0AF; # capital YA
+ F2 D0A0; # capital R
+ F3 D0A1; # capital S
+ F4 D0A2; # capital T
+ F5 D0A3; # capital U
+ F6 D096; # capital ZH
+ F7 D092; # capital V
+ F8 D0AC; # capital soft sign
+ F9 D0AB; # capital Y
+ FA D097; # capital Z
+ FB D0A8; # capital SH
+ FC D0AD; # capital E
+ FD D0A9; # capital SHCH
+ FE D0A7; # capital CH
+ FF D0AA; # capital hard sign
+}
@@ -0,0 +1,102 @@
+charset_map koi8-r windows-1251 {
+
+ 80 88; # euro
+
+ 95 95; # bullet
+
+ 9A A0; # &nbsp;
+
+ 9E B7; # &middot;
+
+ A3 B8; # small yo
+ A4 BA; # small Ukrainian ye
+
+ A6 B3; # small Ukrainian i
+ A7 BF; # small Ukrainian yi
+
+ AD B4; # small Ukrainian soft g
+ AE A2; # small Byelorussian short u
+
+ B0 B0; # &deg;
+
+ B3 A8; # capital YO
+ B4 AA; # capital Ukrainian YE
+
+ B6 B2; # capital Ukrainian I
+ B7 AF; # capital Ukrainian YI
+
+ B9 B9; # numero sign
+
+ BD A5; # capital Ukrainian soft G
+ BE A1; # capital Byelorussian short U
+
+ BF A9; # (C)
+
+ C0 FE; # small yu
+ C1 E0; # small a
+ C2 E1; # small b
+ C3 F6; # small ts
+ C4 E4; # small d
+ C5 E5; # small ye
+ C6 F4; # small f
+ C7 E3; # small g
+ C8 F5; # small kh
+ C9 E8; # small i
+ CA E9; # small j
+ CB EA; # small k
+ CC EB; # small l
+ CD EC; # small m
+ CE ED; # small n
+ CF EE; # small o
+
+ D0 EF; # small p
+ D1 FF; # small ya
+ D2 F0; # small r
+ D3 F1; # small s
+ D4 F2; # small t
+ D5 F3; # small u
+ D6 E6; # small zh
+ D7 E2; # small v
+ D8 FC; # small soft sign
+ D9 FB; # small y
+ DA E7; # small z
+ DB F8; # small sh
+ DC FD; # small e
+ DD F9; # small shch
+ DE F7; # small ch
+ DF FA; # small hard sign
+
+ E0 DE; # capital YU
+ E1 C0; # capital A
+ E2 C1; # capital B
+ E3 D6; # capital TS
+ E4 C4; # capital D
+ E5 C5; # capital YE
+ E6 D4; # capital F
+ E7 C3; # capital G
+ E8 D5; # capital KH
+ E9 C8; # capital I
+ EA C9; # capital J
+ EB CA; # capital K
+ EC CB; # capital L
+ ED CC; # capital M
+ EE CD; # capital N
+ EF CE; # capital O
+
+ F0 CF; # capital P
+ F1 DF; # capital YA
+ F2 D0; # capital R
+ F3 D1; # capital S
+ F4 D2; # capital T
+ F5 D3; # capital U
+ F6 C6; # capital ZH
+ F7 C2; # capital V
+ F8 DC; # capital soft sign
+ F9 DB; # capital Y
+ FA C7; # capital Z
+ FB D8; # capital SH
+ FC DD; # capital E
+ FD D9; # capital SHCH
+ FE D7; # capital CH
+ FF DA; # capital hard sign
+}
Oops, something went wrong.

0 comments on commit ecbfeaf

Please sign in to comment.