Skip to content

Commit fbb24ac

Browse files
committed
- Updated apps vhost configuration fir nginx.
- Enabled Security Level (Server Config > Web > Security Level) for nginx.
1 parent d3dd34b commit fbb24ac

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

install/lib/installer_base.lib.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,9 +1459,18 @@ public function configure_apps_vhost() {
14591459
$content = str_replace('{apps_vhost_port}', $conf['web']['apps_vhost_port'], $content);
14601460
$content = str_replace('{apps_vhost_dir}', $conf['web']['website_basedir'].'/apps', $content);
14611461
$content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content);
1462-
$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
1462+
$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
14631463

14641464
wf($vhost_conf_dir.'/apps.vhost', $content);
1465+
1466+
// PHP-FPM
1467+
// Dont just copy over the php-fpm pool template but add some custom settings
1468+
$content = rf('tpl/php_fpm_pool.conf.master');
1469+
$content = str_replace('{fpm_pool}', 'apps', $content);
1470+
$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
1471+
$content = str_replace('{fpm_user}', $apps_vhost_user, $content);
1472+
$content = str_replace('{fpm_group}', $apps_vhost_group, $content);
1473+
wf($conf['nginx']['php_fpm_pool_dir'].'/apps.conf', $content);
14651474

14661475
//copy('tpl/nginx_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
14671476
//* and create the symlink

interface/web/admin/templates/server_config_web_edit.htm

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h2><tmpl_var name="list_head_txt"></h2>
88
<div class="ctrlHolder">
99
<p class="label">{tmpl_var name='server_type_txt'}</p>
1010
<div class="multiField">
11-
<select name="server_type" id="server_type" class="selectInput" disabled="disabled">
11+
<select name="server_type" id="server_type" class="selectInput">
1212
{tmpl_var name='server_type'}
1313
</select>
1414
</div>
@@ -55,7 +55,7 @@ <h2><tmpl_var name="list_head_txt"></h2>
5555
<label for="CA_pass">{tmpl_var name='CA_pass_txt'}</label>
5656
<input name="CA_pass" id="CA_pass" value="{tmpl_var name='CA_pass'}" size="40" maxlength="255" type="password" class="textInput" />
5757
</div>
58-
<div class="ctrlHolder apache">
58+
<div class="ctrlHolder">
5959
<p class="label">{tmpl_var name='security_level_txt'}</p>
6060
<div class="multiField">
6161
<select name="security_level" id="security_level" class="selectInput">
@@ -162,6 +162,7 @@ <h2><tmpl_var name="list_head_txt"></h2>
162162
</div>
163163
<script language="JavaScript" type="text/javascript">
164164
var serverType = jQuery('#server_type').val();
165+
jQuery('#server_type').replaceWith('<label for="server_Type">'+serverType+'</label><input type="hidden" name="server_type" value="'+serverType+'">');
165166
adjustForm(serverType);
166167
jQuery('#server_type').change(function(){
167168
serverType = $(this).val();
@@ -172,13 +173,9 @@ <h2><tmpl_var name="list_head_txt"></h2>
172173
if(serverType == "nginx"){
173174
jQuery('.nginx').show();
174175
jQuery('.apache').hide();
175-
//jQuery('.tabbox_tabs li').find(":contains('FastCGI')").hide();
176-
//jQuery('.tabbox_tabs li').find(":contains('FastCGI')").remove();
177176
} else {
178177
jQuery('.nginx').hide();
179178
jQuery('.apache').show();
180-
//jQuery('.tabbox_tabs li').find(":contains('FastCGI')").show();
181-
//jQuery('.tabbox_tabs li:eq(4)').after('<li><a href="javascript:changeTab(\'fastcgi\',\'admin/server_config_edit.php\')">FastCGI</a></li>');
182179
}
183180
}
184181
</script>

server/conf/php_fpm_pool.conf.master

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ pm.max_spare_servers = 35
1313

1414
chdir = /
1515

16+
<tmpl_if name='security_level' op='==' value='20'>
17+
1618
<tmpl_var name='enable_php_open_basedir'>php_admin_value[open_basedir] = <tmpl_var name='php_open_basedir'>
19+
</tmpl_if>
20+
1721
<tmpl_loop name="custom_php_ini_settings">
1822
<tmpl_var name='ini_setting'>
1923
</tmpl_loop>

server/plugins-available/nginx_plugin.inc.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,12 +638,10 @@ function update($event_name,$data) {
638638
$vhost_data['web_document_root'] = $data['new']['document_root'].'/web';
639639
$vhost_data['web_document_root_www'] = $web_config['website_basedir'].'/'.$data['new']['domain'].'/web';
640640
$vhost_data['web_basedir'] = $web_config['website_basedir'];
641-
$vhost_data['security_level'] = $web_config['security_level'];
642-
$vhost_data['allow_override'] = ($data['new']['allow_override'] == '')?'All':$data['new']['allow_override'];
643641
$vhost_data['ssl_domain'] = $data['new']['ssl_domain'];
644642
//$vhost_data['has_custom_php_ini'] = $has_custom_php_ini;
645643
//$vhost_data['custom_php_ini_dir'] = escapeshellcmd($custom_php_ini_dir);
646-
$vhost_data['fpm_port'] = $web_config['php_fpm_start_port'] + $data['new']['domain_id'];
644+
$vhost_data['fpm_port'] = $web_config['php_fpm_start_port'] + $data['new']['domain_id'] + 1;
647645

648646
// Check if a SSL cert exists
649647
$ssl_dir = $data['new']['document_root'].'/ssl';
@@ -1098,9 +1096,10 @@ private function php_fpm_pool_update ($data,$web_config) {
10981096
$tpl->newTemplate('php_fpm_pool.conf.master');
10991097

11001098
$tpl->setVar('fpm_pool', $data['new']['domain']);
1101-
$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id']);
1099+
$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] + 1);
11021100
$tpl->setVar('fpm_user', $data['new']['system_user']);
11031101
$tpl->setVar('fpm_group', $data['new']['system_group']);
1102+
$tpl->setVar('security_level',$web_config['security_level']);
11041103
$php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']);
11051104
$tpl->setVar('php_open_basedir', $php_open_basedir);
11061105
if($php_open_basedir != ''){

0 commit comments

Comments
 (0)