Question

timeout settings for our server

we have the following timeout for external seo bot connecting with our site https://clip2net.com/s/4lIWTcC

agency suggest increasing that timeout setting but we cannot find that under our droplet settings. We run Ubuntu 23.10 x64 on droplet, use cloudflare

can you suggest where we shall search for timeout settings please?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
October 29, 2024

Hey there!

The timeout settings for external connections on your Ubuntu server aren’t managed directly through the Droplet settings on DigitalOcean but can be configured in a few key places on your server itself which you have root access to.

As you’re using Cloudflare and an Ubuntu Droplet, here’s where you can look to increase the timeout:

  1. Cloudflare has a default timeout of 100 seconds for HTTP requests. Unfortunately, this is a fixed limit and can’t be extended directly through Cloudflare’s free plan. If you’re on a paid plan, you may have options to adjust this under “Load Balancing” or “Workers”, but it’s still limited. For more information check out their docs here: https://community.cloudflare.com/t/increase-cloudflare-max-request-duration/482873

  2. Nginx or Apache Timeout Settings on your Droplet:

    • If you’re using Nginx or Apache as your web server, you can adjust the timeout settings to handle longer connections.

    For Nginx:

    • Open the Nginx configuration file (usually located at /etc/nginx/nginx.conf or within /etc/nginx/sites-available/).
    • Add or update these directives within your server block:
      proxy_read_timeout 300s;
      proxy_connect_timeout 300s;
      proxy_send_timeout 300s;
      
    • Restart Nginx:
      sudo systemctl restart nginx
      

    For Apache:

    • Open the Apache configuration file, typically found at /etc/apache2/apache2.conf or in /etc/apache2/sites-available/.
    • Add or update these directives:
      Timeout 300
      ProxyTimeout 300
      
    • Restart Apache:
      sudo systemctl restart apache2
      
  3. PHP Timeout Settings:

    • If you’re running a PHP application, you may also want to increase the execution time for PHP scripts.
    • Open your PHP configuration file (php.ini, often located at /etc/php/8.2/fpm/php.ini or /etc/php/8.2/apache2/php.ini).
    • Update these settings:
      max_execution_time = 300
      max_input_time = 300
      
    • Restart PHP-FPM (if applicable):
      sudo systemctl restart php8.2-fpm
      

Feel free to share more details on the services that you are using if those are not the ones you use.

Also worth mentioning that, extending timeout settings too much can sometimes lead to performance issues, as long connections consume resources. Make sure these settings match your server’s capacity like RAM and CPU.

- Bobby

KFSys
Site Moderator
Site Moderator badge
October 31, 2024

To adjust the timeout settings for connections to your site on Ubuntu 23.10 with Cloudflare, consider the following places to check and modify:

1. Nginx or Apache Web Server

If you’re using Nginx or Apache, these web servers have timeout settings you can adjust to accommodate longer connection times.

  • For Nginx: Open your Nginx configuration file (often located in /etc/nginx/nginx.conf or /etc/nginx/sites-available/your_site), and look for these directives:
client_body_timeout 60;
client_header_timeout 60;
keepalive_timeout 60;
send_timeout 60;

Adjust the values as needed (e.g., 60 seconds). After changes, restart Nginx:

sudo systemctl restart nginx
  • For Apache: If you use Apache, edit /etc/apache2/apache2.conf or your specific virtual host file and set:
Timeout 60
KeepAliveTimeout 60

Then, restart Apache:

sudo systemctl restart apache2

2. Cloudflare Settings

Cloudflare also enforces its own timeouts. By default:

  • Free and Pro plans have a 100-second limit on HTTP requests.
  • Business and Enterprise plans offer options to extend this with customizable timeout settings.

If you need a longer timeout than what your current Cloudflare plan allows, you may want to discuss options with Cloudflare support or upgrade to a plan with more flexible timeout settings.

3. Droplet Firewall or Proxy Settings

  • If you’re using a firewall (like ufw), verify that it doesn’t impose additional timeouts.
  • Also, check for any reverse proxy configurations on the droplet, as they can impose separate timeout settings similar to those of Nginx and Apache.

4. Application-Specific Timeout Settings

If your application framework has its own timeout setting, check and adjust it as needed. For instance:

  • Django and Flask apps may have timeout settings in the WSGI server (like Gunicorn or uWSGI).
  • Node.js applications typically set timeouts in the server configuration:
server.setTimeout(60000); // 60 seconds
alexdo
Site Moderator
Site Moderator badge
November 8, 2024

Heya, @salesc322b5c406a5cdf950441

On top of what’s already mentioned, it’s possible that a restrictive robots.txt file could be affecting how SEO bots interact with your site, but it wouldn’t typically cause a timeout.

This is more a long shot, but it wont hurt checking that a robots file is not denying access to crawlers as well.

Regards

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.