FIX: #0 Increase fastcgi_read_timeout to 300s to prevent 504 timeouts on permissions page
Some checks failed
Deploy Beta (NATIVE) / deploy (push) Has been cancelled
Some checks failed
Deploy Beta (NATIVE) / deploy (push) Has been cancelled
This commit is contained in:
parent
9499106180
commit
846240a5e7
1 changed files with 22 additions and 9 deletions
|
|
@ -11,7 +11,6 @@ try:
|
|||
os.symlink(target_path, symlink_path)
|
||||
print(f"Created symlink {symlink_path} -> {target_path}")
|
||||
except Exception as e:
|
||||
# If standard user cannot do it, let's print message or handle it via subprocess in bash
|
||||
print(f"Symlink creation message: {e}")
|
||||
|
||||
filepath = '/etc/nginx/sites-available/default'
|
||||
|
|
@ -19,12 +18,8 @@ filepath = '/etc/nginx/sites-available/default'
|
|||
if os.path.exists(filepath):
|
||||
content = open(filepath).read()
|
||||
|
||||
# Remove any old alias block if it exists
|
||||
old_block_marker = 'location ^~ /dolibarrbeta'
|
||||
if old_block_marker in content:
|
||||
# We can clean up the configuration file by removing the old block
|
||||
# To be safe, we will rewrite the file cleanly with the new root block
|
||||
content = content.replace(r''' location ^~ /dolibarrbeta {
|
||||
# Remove old alias block if it exists
|
||||
old_alias_block = r''' location ^~ /dolibarrbeta {
|
||||
alias /home/ubuntu/dolibarrbeta/htdocs;
|
||||
index index.php;
|
||||
try_files $uri $uri/ /dolibarrbeta/index.php?$args;
|
||||
|
|
@ -34,9 +29,26 @@ if os.path.exists(filepath):
|
|||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
|
||||
}
|
||||
}''', '')
|
||||
}'''
|
||||
content = content.replace(old_alias_block, '')
|
||||
|
||||
# Remove old root-based block without timeout if it exists
|
||||
old_root_block = r"""location /dolibarrbeta {
|
||||
root /var/www/html;
|
||||
index index.php;
|
||||
try_files $uri $uri/ /dolibarrbeta/index.php?$args;
|
||||
|
||||
# Insert the new correct root-based location block
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
|
||||
}
|
||||
}
|
||||
|
||||
"""
|
||||
content = content.replace(old_root_block, '')
|
||||
|
||||
# Insert the new correct root-based location block with increased timeout
|
||||
if 'location /dolibarrbeta' not in content:
|
||||
idx = content.find('location / {')
|
||||
if idx != -1:
|
||||
|
|
@ -49,6 +61,7 @@ if os.path.exists(filepath):
|
|||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
|
||||
fastcgi_read_timeout 300;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue