﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
532	Make Nginx configs easy to understand and shorted	Andre Fish		"The Nginx way of using config files is very long and means useless things have to be pasted twice. It's also impossible to define a default host. 

For example, if i want to add a vhost my defualt site-enabled config would be this, and I would have to add a massive server block for each vhost...


{{{
server {
        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default_server ipv6only=on; ## listen for ipv6
        root /var/www/de.domain.net;
        index index.php index.html index.htm;
        server_name _;
        location / {
                try_files $uri $uri/ /index.html;
        }
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
                location ~ /\.ht {
                deny all;
        }
}

server {
        root /var/www/linuxthefish.net;
        server_name domain.net;
        index index.php index.html index.htm;
        location / {
                try_files $uri $uri/ /index.html;
        }
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
                location ~ /\.ht {
                deny all;
        }


}

}}}

Whereas something like lighttpd you can define where PHP and index files are in the first bit of a lighttpd config, making it a lot easier to manage lots of websites:


{{{
fastcgi.server += ( "".php"" =>
        ((
                ""bin-path"" => ""/usr/bin/php-cgi"",
                ""socket"" => ""/var/run/lighttpd/php.socket"",
                ""max-procs"" => 1,
                ""bin-environment"" => (
                        ""PHP_FCGI_CHILDREN"" => ""10"",
                        ""PHP_FCGI_MAX_REQUESTS"" => ""10000""
                ),
                ""bin-copy-environment"" => (
                        ""PATH"", ""SHELL"", ""USER""
                ),
                ""broken-scriptfilename"" => ""enable""
        ))
)


}}}


{{{
$HTTP[""host""] =~ ""(^|\.)domain\.net$"" {
server.document-root = ""/var/www/domain.net""
}

$HTTP[""host""] =~ ""(^|\.)domain2\.co.uk$"" {
server.document-root = ""/var/www/domain2.co.uk""
}
}}}"	enhancement	closed	major		nginx-core	1.2.x	wontfix			Linux de.domain.net 2.6.32-042stab083.2 #1 SMP Fri Nov 8 18:08:40 MSK 2013 x86_64 GNU/Linux	"nginx version: nginx/1.2.1
TLS SNI support enabled
configure arguments: --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=/tmp/buildd/nginx-1.2.1/debian/modules/nginx-auth-pam --add-module=/tmp/buildd/nginx-1.2.1/debian/modules/nginx-echo --add-module=/tmp/buildd/nginx-1.2.1/debian/modules/nginx-upstream-fair --add-module=/tmp/buildd/nginx-1.2.1/debian/modules/nginx-dav-ext-module"
