Docs / Stackposts

Fix “503 Service Unavailable” When Uploading in Stackposts (aaPanel + Nginx + PHP 8.x)

💡 Summary Fix 3 parts:① PHP → increase upload & execution limits② Nginx → raise timeouts & file size limits③ PHP-FPM → increase workers and request timeout ✅ Step 1 –...

Estimated reading: 2 minutes

💡 Summary

Fix 3 parts:
① PHP → increase upload & execution limits
② Nginx → raise timeouts & file size limits
③ PHP-FPM → increase workers and request timeout

✅ Step 1 – Configure PHP

In aaPanel → App Store → PHP 8.x → Setting → Configuration, set:

upload_max_filesize = 1024M post_max_size = 1024M memory_limit = 2048M max_execution_time = 600 max_input_time = 600

→ Click SaveRestart PHP 8.x


✅ Step 2 – Configure Nginx

Open your domain config file:

/www/server/panel/vhost/nginx/post.domain.com.conf

and add (or update) the following inside the server { ... } block:

# --- Fix upload & timeout --- client_max_body_size 1024M; client_body_timeout 600s; send_timeout 600s; proxy_read_timeout 600s; fastcgi_read_timeout 600s; fastcgi_send_timeout 600s; location ~ \.php$ { fastcgi_pass unix:/tmp/php-cgi-8x.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_connect_timeout 600; fastcgi_read_timeout 600; fastcgi_send_timeout 600; }

(replace 8x with your PHP version, e.g. 80, 81, 82, 83)

SaveRestart Nginx


✅ Step 3 – Configure PHP-FPM

Open:

/www/server/php/8x/etc/php-fpm.conf

Find the [www] section and ensure:

[www] listen = /tmp/php-cgi-8x.sock listen.owner = www listen.group = www listen.mode = 0660 pm = dynamic pm.max_children = 50 pm.start_servers = 5 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 request_terminate_timeout = 600

→ Save → Restart PHP 8.x


✅ Step 4 – Test

  1. Open info.php → confirm php-fpm: active.

  2. Upload an image or video in Stackposts → ✅ No more 503 Service Unavailable.