Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx improvements #36

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions virtual_feature.pl
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,12 @@ sub feature_setup
'words' => [ '~', '\.php(/|$)' ],
'type' => 1,
'members' => [
{ 'name' => 'try_files',
'words' => [ '$uri', '$fastcgi_script_name', '=404' ],
},
{ 'name' => 'try_files',
'words' => [ '$uri', '$fastcgi_script_name', '=404' ],
},
{ 'name' => 'default_type',
'words' => [ 'application/x-httpd-php' ],
}
],
};
&save_directive($server, [ ], [ $ploc ]);
Expand Down Expand Up @@ -1274,16 +1277,19 @@ sub feature_save_web_php_mode
# Update the port in the config, if changed
if (!$loc) {
&lock_file($server->{'file'});
$loc = { 'name' => 'location',
'words' => [ '~', '\.php(/|$)' ],
'type' => 1,
'members' => [
{ 'name' => 'try_files',
'words' => [ '$uri', '$fastcgi_script_name',
'=404' ],
},
],
};
$loc =
{ 'name' => 'location',
'words' => [ '~', '\.php(/|$)' ],
'type' => 1,
'members' => [
{ 'name' => 'default_type',
'words' => [ 'application/x-httpd-php' ],
},
{ 'name' => 'try_files',
'words' => [ '$uri', '$fastcgi_script_name', '=404' ],
},
],
};
&save_directive($server, [ ], [ $loc ]);
&flush_file_lines($server->{'file'});
&unlock_file($server->{'file'});
Expand All @@ -1300,7 +1306,20 @@ sub feature_save_web_php_mode
# Remove the location block
if ($loc) {
&lock_file($server->{'file'});
&save_directive($server, [ $loc ], [ ]);
my $locdeftype =
{ 'name' => 'location',
'words' => [ '~', '\.php(/|$)' ],
'type' => 1,
'members' => [
{ 'name' => 'default_type',
'words' => [ 'text/plain' ],
},
{ 'name' => 'try_files',
'words' => [ '$uri', '$fastcgi_script_name', '=404' ],
},
],
};
&save_directive($server, [ $loc ], [ $locdeftype ]);
&flush_file_lines($server->{'file'});
&unlock_file($server->{'file'});
&virtual_server::register_post_action(\&print_apply_nginx);
Expand Down