Commit 8e2c2e1c authored by Falko Timme's avatar Falko Timme
Browse files

- Added IPv6 support for nginx.

parent 793622bd
server {
listen <tmpl_var name='ip_address'>:80;
<tmpl_if name='ssl_enabled'>
<tmpl_if name='ipv6_enabled'>
listen [<tmpl_var name='ipv6_address'>]:80;
</tmpl_if>
<tmpl_if name='ssl_enabled'>
listen <tmpl_var name='ip_address'>:443 ssl;
<tmpl_if name='ipv6_enabled'>
listen [<tmpl_var name='ipv6_address'>]:443 ssl;
</tmpl_if>
ssl_certificate <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.crt;
ssl_certificate_key <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.key;
</tmpl_if>
</tmpl_if>
server_name <tmpl_var name='domain'> <tmpl_var name='alias'>;
root <tmpl_var name='web_document_root_www'>;
<tmpl_if name='seo_redirect_enabled'>
<tmpl_if name='seo_redirect_enabled'>
if ($http_host = "<tmpl_var name='seo_redirect_origin_domain'>") {
rewrite ^ $scheme://<tmpl_var name='seo_redirect_target_domain'>$request_uri permanent;
}
</tmpl_if>
<tmpl_loop name="redirects">
</tmpl_if>
<tmpl_loop name="redirects">
if ($http_host ~* "<tmpl_var name='rewrite_domain'>$") {
rewrite ^/(.+)$ <tmpl_var name='rewrite_target'>$1 <tmpl_var name='rewrite_type'>;
}
</tmpl_loop>
</tmpl_loop>
index index.html index.htm index.php index.cgi index.pl index.xhtml;
<tmpl_if name='ssi' op='==' value='y'>
<tmpl_if name='ssi' op='==' value='y'>
location ~ \.shtml$ {
ssi on;
}
</tmpl_if>
</tmpl_if>
<tmpl_if name='errordocs'>
<tmpl_if name='errordocs'>
error_page 400 /error/400.html;
error_page 401 /error/401.html;
error_page 403 /error/403.html;
......@@ -43,7 +45,7 @@ server {
error_page 405 /error/405.html;
error_page 500 /error/500.html;
error_page 503 /error/503.html;
</tmpl_if>
</tmpl_if>
error_log /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log;
access_log /var/log/ispconfig/httpd/<tmpl_var name='domain'>/access.log combined;
......@@ -72,26 +74,27 @@ server {
auth_basic_user_file <tmpl_var name='stats_auth_passwd_file'>;
}
<tmpl_if name='php' op='==' value='fast-cgi'>
<tmpl_if name='php' op='==' value='fast-cgi'>
location ~ \.php$ {
try_files $uri =404;
<tmpl_var name='use_tcp'>fastcgi_pass 127.0.0.1:<tmpl_var name='fpm_port'>;
<tmpl_var name='use_socket'>fastcgi_pass unix:<tmpl_var name='fpm_socket'>;
<tmpl_if name='use_tcp'>
fastcgi_pass 127.0.0.1:<tmpl_var name='fpm_port'>;
</tmpl_if>
<tmpl_if name='use_socket'>
fastcgi_pass unix:<tmpl_var name='fpm_socket'>;
</tmpl_if>
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
</tmpl_else>
</tmpl_else>
location ~ \.php$ {
deny all;
}
</tmpl_if>
<tmpl_if name='cgi' op='==' value='y'>
</tmpl_if>
<tmpl_if name='cgi' op='==' value='y'>
location /cgi-bin/ {
try_files $uri =404;
root <tmpl_var name='document_root'>;
......@@ -101,10 +104,9 @@ server {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
</tmpl_if>
</tmpl_if>
<tmpl_loop name="nginx_directives">
<tmpl_loop name="nginx_directives">
<tmpl_var name='nginx_directive'>
</tmpl_loop>
</tmpl_loop>
}
\ No newline at end of file
[<tmpl_var name='fpm_pool'>]
<tmpl_var name='use_tcp'>listen = 127.0.0.1:<tmpl_var name='fpm_port'>
<tmpl_var name='use_tcp'>listen.allowed_clients = 127.0.0.1
<tmpl_var name='use_socket'>listen = <tmpl_var name='fpm_socket'>
<tmpl_var name='use_socket'>listen.owner = <tmpl_var name='fpm_user'>
<tmpl_var name='use_socket'>listen.group = <tmpl_var name='fpm_group'>
<tmpl_var name='use_socket'>listen.mode = 0660
<tmpl_if name='use_tcp'>
listen = 127.0.0.1:<tmpl_var name='fpm_port'>
listen.allowed_clients = 127.0.0.1
</tmpl_if>
<tmpl_if name='use_socket'>
listen = <tmpl_var name='fpm_socket'>
listen.owner = <tmpl_var name='fpm_user'>
listen.group = <tmpl_var name='fpm_group'>
listen.mode = 0660
</tmpl_if>
user = <tmpl_var name='fpm_user'>
group = <tmpl_var name='fpm_group'>
......@@ -20,7 +23,6 @@ pm.max_spare_servers = 35
chdir = /
<tmpl_if name='security_level' op='==' value='20'>
<tmpl_var name='enable_php_open_basedir'>php_admin_value[open_basedir] = <tmpl_var name='php_open_basedir'>
</tmpl_if>
......
......@@ -638,7 +638,9 @@ class nginx_plugin {
$vhost_data['web_document_root'] = $data['new']['document_root'].'/web';
$vhost_data['web_document_root_www'] = $web_config['website_basedir'].'/'.$data['new']['domain'].'/web';
$vhost_data['web_basedir'] = $web_config['website_basedir'];
$vhost_data['ssl_domain'] = $data['new']['ssl_domain'];
// IPv6
if($data['new']['ipv6_address'] != '') $tpl->setVar('ipv6_enabled', 1);
// PHP-FPM
$pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
......@@ -648,11 +650,11 @@ class nginx_plugin {
if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
if($data['new']['php_fpm_use_socket'] == 'y'){
$use_tcp = '#';
$use_socket = '';
$use_tcp = 0;
$use_socket = 1;
} else {
$use_tcp = '';
$use_socket = '#';
$use_tcp = 1;
$use_socket = 0;
}
$tpl->setVar('use_tcp', $use_tcp);
$tpl->setVar('use_socket', $use_socket);
......@@ -1113,12 +1115,12 @@ class nginx_plugin {
$tpl->newTemplate('php_fpm_pool.conf.master');
if($data['new']['php_fpm_use_socket'] == 'y'){
$use_tcp = ';';
$use_socket = '';
$use_tcp = 0;
$use_socket = 1;
if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
} else {
$use_tcp = '';
$use_socket = ';';
$use_tcp = 1;
$use_socket = 0;
}
$tpl->setVar('use_tcp', $use_tcp);
$tpl->setVar('use_socket', $use_socket);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment