Setting upload limits in gnusocial/postactiv

This commit is contained in:
Bob Mottram 2018-03-06 19:53:48 +00:00
parent 782b57c565
commit 5846205b48
4 changed files with 35 additions and 4 deletions

View File

@ -724,6 +724,8 @@ function install_gnusocial_main {
echo '';
echo ' # PHP';
echo ' location ~ \.php {';
echo ' client_max_body_size 50m;';
echo ' client_body_buffer_size 50m;';
echo ' include snippets/fastcgi-php.conf;';
echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
echo ' fastcgi_read_timeout 30;';
@ -738,6 +740,8 @@ function install_gnusocial_main {
echo '';
echo ' # Fancy URLs';
echo ' location @gnusocial {';
echo ' client_max_body_size 50m;';
echo ' client_body_buffer_size 50m;';
echo " rewrite ^(.*)\$ /index.php?p=\$1 last;";
echo ' }';
echo '';
@ -771,6 +775,8 @@ function install_gnusocial_main {
echo '';
echo ' # PHP';
echo ' location ~ \.php {';
echo ' client_max_body_size 50m;';
echo ' client_body_buffer_size 50m;';
echo ' include snippets/fastcgi-php.conf;';
echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
echo ' fastcgi_read_timeout 30;';
@ -785,6 +791,8 @@ function install_gnusocial_main {
echo '';
echo ' # Fancy URLs';
echo ' location @gnusocial {';
echo ' client_max_body_size 50m;';
echo ' client_body_buffer_size 50m;';
echo " rewrite ^(.*)\$ /index.php?p=\$1 last;";
echo ' }';
echo '';
@ -794,6 +802,9 @@ function install_gnusocial_main {
echo ' }';
echo '}'; } >> "$gnusocial_nginx_site"
function_check gnusocial_set_limits
gnusocial_set_limits "$gnusocial_nginx_site"
function_check configure_php
configure_php

View File

@ -738,6 +738,8 @@ function install_postactiv_main {
echo '';
echo ' # PHP';
echo ' location ~ \.php {';
echo ' client_max_body_size 50m;';
echo ' client_body_buffer_size 50m;';
echo ' include snippets/fastcgi-php.conf;';
echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
echo ' fastcgi_read_timeout 30;';
@ -752,6 +754,8 @@ function install_postactiv_main {
echo '';
echo ' # Fancy URLs';
echo ' location @postactiv {';
echo ' client_max_body_size 50m;';
echo ' client_body_buffer_size 50m;';
echo " rewrite ^(.*)\$ /index.php?p=\$1 last;";
echo ' }';
echo '';
@ -785,6 +789,8 @@ function install_postactiv_main {
echo '';
echo ' # PHP';
echo ' location ~ \.php {';
echo ' client_max_body_size 50m;';
echo ' client_body_buffer_size 50m;';
echo ' include snippets/fastcgi-php.conf;';
echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
echo ' fastcgi_read_timeout 30;';
@ -799,6 +805,8 @@ function install_postactiv_main {
echo '';
echo ' # Fancy URLs';
echo ' location @postactiv {';
echo ' client_max_body_size 50m;';
echo ' client_body_buffer_size 50m;';
echo " rewrite ^(.*)\$ /index.php?p=\$1 last;";
echo ' }';
echo '';
@ -808,6 +816,9 @@ function install_postactiv_main {
echo ' }';
echo '}'; } >> "$postactiv_nginx_site"
function_check gnusocial_set_limits
gnusocial_set_limits "$postactiv_nginx_site"
function_check configure_php
configure_php

View File

@ -43,6 +43,14 @@ SHARINGS_THEME_COMMIT='a46ef375d19e8ef6889653668a7e697b0ba2013c'
GNUSOCIAL_MARKDOWN_REPO="https://git.gnu.io/chimo/markdown.git"
GNUSOCIAL_MARKDOWN_COMMIT='03c53942f94b3376f0946e6e1fe566cc21ccf232'
function gnusocial_set_limits {
filename="$1"
sed -i 's|client_body_buffer_size.*|client_body_buffer_size 5m;|g' "$filename"
sed -i 's|limit_conn conn_limit_per_ip.*|limit_conn conn_limit_per_ip 100;|g' "$filename"
sed -i 's|req_limit_per_ip.*|req_limit_per_ip burst=100 nodelay;|g' "$filename"
}
# Stuff to be done after restoring from backup
function gnusocial_update_after_restore {
gnusocial_variant="$1"

View File

@ -415,11 +415,12 @@ function letsencrypt_renewals {
}
function configure_php {
sed -i "s/memory_limit = 128M/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php/7.0/fpm/php.ini
sed -i "s/memory_limit =.*/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php/7.0/fpm/php.ini
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/7.0/fpm/php.ini
sed -i "s/memory_limit = -1/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php/7.0/cli/php.ini
sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 50M/g" /etc/php/7.0/fpm/php.ini
sed -i "s/post_max_size = 8M/post_max_size = 50M/g" /etc/php/7.0/fpm/php.ini
sed -i "s/memory_limit =.*/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php/7.0/cli/php.ini
sed -i "s/upload_max_filesize =.*/upload_max_filesize = 50M/g" /etc/php/7.0/fpm/php.ini
sed -i "s/upload_max_filesize =.*/upload_max_filesize = 50M/g" /etc/php/7.0/cli/php.ini
sed -i "s/post_max_size =.*/post_max_size = 50M/g" /etc/php/7.0/fpm/php.ini
}
function install_web_server_access_control {