Docs / Stackposts

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

🚀 Fix “Request Timeout” & “Service Unavailable” (aaPanel + Apache + PHP 8.x) 💡 Summary You must adjust three areas to fix timeouts permanently: ① Increase upload limits in PH...

Estimated reading: 2 minutes

🚀 Fix “Request Timeout” & “Service Unavailable” (aaPanel + Apache + PHP 8.x)

💡 Summary

You must adjust three areas to fix timeouts permanently:

① Increase upload limits in PHP
② Raise timeout limits in Apache
③ Extend process / execution time in PHP-FPM


✅ Step 1 – Configure PHP

Path:
aaPanel → App Store → PHP 8.x → Setting → Configuration

Set these values:

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

Then Save → Restart PHP 8.x

💡 These parameters control how large and how long PHP accepts uploads and requests.


✅ Step 2 – Configure Apache

Path:
/www/server/panel/vhost/apache/post.domain.com.conf
(Replace post.domain.com with your actual domain.)

Add the following before </VirtualHost>:

# --- Timeout & Upload Settings --- Timeout 600 ProxyTimeout 600 LimitRequestBody 0 # Optional: Only include if mod_reqtimeout is enabled # RequestReadTimeout header=60 body=120 <Directory "/www/wwwroot/post.domain.com/"> Options FollowSymLinks AllowOverride All Require all granted LimitRequestBody 0 </Directory>

Then Save → Restart Apache

💡 If you receive “Invalid command ‘RequestReadTimeout’”,
comment out the module line in httpd.conf:

#LoadModule reqtimeout_module modules/mod_reqtimeout.so

and remove the RequestReadTimeout directive — this disables Apache’s strict request timer completely.


✅ Step 3 – Configure PHP-FPM

Path:
/www/server/php/8x/etc/php-fpm.conf
(or /www/server/php/8x/etc/php-fpm.d/www.conf)

Update / confirm the following inside the [www] section:

[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 request_slowlog_timeout = 30

Then Save → Restart PHP 8.x

💡 These settings let PHP-FPM handle longer executions (up to 10 minutes).


✅ Step 4 – Verify & Test

  1. Create a file at /www/wwwroot/post.domain.com/info.php:

    <?php phpinfo(); ?>
  2. Visit https://post.domain.com/info.php

    • Confirm PHP-FPM is active.

    • Check that upload_max_filesize, post_max_size, and max_execution_time show your new values.

  3. Upload an image / video or perform a long request.

✅ You should no longer see:

  • “Request Timeout – Server timeout waiting for the HTTP request from the client.”

  • “503 Service Unavailable.”


🧰 Optional (Recommended for stability)

Add to the bottom of /www/server/apache/conf/httpd.conf:

Timeout 600 KeepAlive On KeepAliveTimeout 15 MaxKeepAliveRequests 200

Then restart Apache:

service httpd restart

✅ Final Result

Your aaPanel + Apache + PHP 8.x server will now:

  • Accept uploads up to 1 GB or more

  • Handle long-running PHP scripts (up to 10 minutes)

  • Avoid 408 / 503 timeouts permanently