{"id":14440,"date":"2025-10-30T05:31:15","date_gmt":"2025-10-30T11:31:15","guid":{"rendered":"https:\/\/www.supportpro.com\/blog\/?p=14440"},"modified":"2026-03-31T00:06:38","modified_gmt":"2026-03-31T06:06:38","slug":"optimizing-nginx-apache-settings-in-runcloud-for-better-performance","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/optimizing-nginx-apache-settings-in-runcloud-for-better-performance\/","title":{"rendered":"Optimizing Nginx &amp; Apache Settings in RunCloud for Better Performance"},"content":{"rendered":"\n<p>If you\u2019ve ever had a website slow down the moment traffic picks up, you\u2019ll know how helpless that feels. You open the dashboard, refresh the monitor, maybe even restart the service, and still, it lags. In most of those moments, the problem isn\u2019t that your server is weak. It\u2019s usually that PHP and your FPM pool just aren\u2019t tuned quite right.<\/p>\n\n\n\n<p>I\u2019ve spent a lot of long nights inside RunCloud dashboards, and over time I\u2019ve built a habit of adjusting a few key settings whenever I launch or optimize a client\u2019s app. RunCloud is great for this because you don\u2019t have to touch the terminal much; you can change everything straight from the panel.<\/p>\n\n\n\n<p>So, instead of throwing more CPU or RAM at the issue, here\u2019s how I approach <strong>getting the best out of PHP and FPM<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Why These Little Tweaks Matter<\/strong><\/h3>\n\n\n\n<p>People often focus on upgrading hosting when their site feels slow. That works sometimes; but not if PHP is choking because it\u2019s trying to run too many processes, or it\u2019s timing out too early.<\/p>\n\n\n\n<p>Think of PHP and FPM settings like the tuning knobs on an old amplifier. You can have the best hardware in the world, but if it\u2019s not adjusted right, the output just won\u2019t sound good.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Part 1: PHP Settings That Actually Make a Difference<\/strong><\/h2>\n\n\n\n<p>RunCloud\u2019s PHP settings area is pretty straightforward, but understanding what to tweak is what separates a smooth-running site from one that keeps freezing at random.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. max_execution_time -When PHP Gives Up<\/strong><\/h3>\n\n\n\n<p>This setting tells PHP when to stop waiting for a script to finish.<br>If you\u2019ve ever had an import hang forever or a backup quit halfway through, this is the reason.<\/p>\n\n\n\n<p>The default is <strong>30 seconds<\/strong>, which is fine for lightweight sites. But if you\u2019re dealing with something heavier, like WooCommerce imports or image optimization tasks, bump it to <strong>300 seconds<\/strong>.<\/p>\n\n\n\n<p>That said, don\u2019t use this as an excuse to let inefficient scripts run wild; it\u2019s there to help genuine heavy lifting, not to mask sloppy code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. max_input_time &#8211; Time Spent Reading Data<\/strong><\/h3>\n\n\n\n<p>This controls how long PHP will spend reading incoming data (like form submissions or uploads).<br>If your site handles big uploads or massive forms, increasing it to <strong>300 seconds<\/strong> saves you from annoying timeouts.<\/p>\n\n\n\n<p>If you\u2019re running something small, leave it alone &#8211; the default usually works fine.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. max_input_vars &#8211; How Many Fields PHP Can Handle<\/strong><\/h3>\n\n\n\n<p>This one\u2019s sneaky. Some CMS tools and plugins throw thousands of fields at PHP. If it\u2019s capped too low, PHP just\u2026 drops some of them.<\/p>\n\n\n\n<p>I usually start by increasing this from <strong>1000<\/strong> to <strong>3000 or 5000<\/strong>, depending on the app. But go slow &#8211; higher limits can eat into memory and slow things down if you\u2019re not careful.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. memory_limit &#8211; The Hidden Bottleneck<\/strong><\/h3>\n\n\n\n<p>If you\u2019ve ever had a script crash without an obvious reason, check this first.<br>The memory limit sets how much RAM each PHP process can use.<\/p>\n\n\n\n<p>If it\u2019s too low, big scripts crash mid-process. Too high, and you\u2019ll starve the rest of your system.<br>For a 16 GB server, I\u2019ve found that giving PHP around <strong>4\u20136 GB<\/strong> keeps things balanced.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. post_max_size &#8211; How Big a POST Can Be<\/strong><\/h3>\n\n\n\n<p>This decides how much data PHP will accept in a single POST request. It\u2019s especially relevant if your site allows file uploads.<\/p>\n\n\n\n<p>If uploads are failing, the cause is often that this limit is smaller than your upload size.<br>For example, if you allow 100MB uploads, set post_max_size to at least <strong>128MB<\/strong> to be safe.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>6. upload_max_filesize &#8211; The File Upload Ceiling<\/strong><\/h3>\n\n\n\n<p>This one\u2019s directly tied to the setting above. It defines how large a single uploaded file can be.<\/p>\n\n\n\n<p>If users send big files &#8211; PDFs, videos, or image-heavy documents, make sure this value actually matches what your site allows. I\u2019ve seen sites where it\u2019s left at 8MB while the business tries to upload 60MB videos.<\/p>\n\n\n\n<p>And remember: PHP can\u2019t go higher than what your web server or operating system permits. Everything needs to match.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7. session.gc_maxlifetime &#8211; How Long Users Stay Logged In<\/strong><\/h3>\n\n\n\n<p>Nothing annoys users faster than being logged out mid-task.<\/p>\n\n\n\n<p>This setting tells PHP how long a session can live before it\u2019s deleted. For e-commerce or admin dashboards, increase it so users don\u2019t lose carts or work.<\/p>\n\n\n\n<p>I often set it somewhere between <strong>1 and 4 hours<\/strong>, depending on the app. It\u2019s not glamorous, but it\u2019s one of those small changes that make the user experience noticeably better.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Part 2: Getting PHP-FPM Right<\/strong><\/h2>\n\n\n\n<p>Once PHP is behaving, turn to <strong><a href=\"https:\/\/www.supportpro.com\/blog\/how-to-enable-and-customize-php-fpm-directives-pool-per-domain-or-server-wide-cpanel\/\" title=\"\">PHP-FPM<\/a><\/strong> that\u2019s the piece that actually manages PHP workers and handles the traffic load.<br>Getting this right is the difference between a site that <em>occasionally stutters<\/em> and one that stays rock solid when 200 people hit it at once.<\/p>\n\n\n\n<p>RunCloud lets you adjust these settings in the dashboard, which makes testing changes less intimidating.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>FPM Modes Explained in Plain English<\/strong><\/h3>\n\n\n\n<p>PHP-FPM can run in three modes, and choosing the right one matters more than people think:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>On-Demand<\/strong> \u2013 Spawns workers only when requests come in. Perfect for low-traffic sites or staging environments.<\/li>\n\n\n\n<li><strong>Dynamic<\/strong> \u2013 Keeps a few workers ready, then adds or removes as traffic changes. I use this 90% of the time &#8211; it\u2019s flexible and reliable.<\/li>\n\n\n\n<li><strong>Static<\/strong> \u2013 Keeps a fixed number of workers running constantly. Great for high, steady traffic (like SaaS apps), but it eats memory.<\/li>\n<\/ul>\n\n\n\n<p>If you\u2019re unsure, start with <strong>Dynamic<\/strong>, then watch your graphs. RunCloud gives great insight into how workers scale during load.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Important FPM Parameters You\u2019ll See<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><div class=\"pcrstb-wrap\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Setting<\/strong><\/td><td><strong>What It Controls<\/strong><\/td><td><strong>Why It Matters<\/strong><\/td><\/tr><tr><td>pm.start_servers<\/td><td>How many workers start initially<\/td><td>Too few = cold starts, too many = wasted RAM<\/td><\/tr><tr><td>pm.min_spare_servers<\/td><td>Minimum idle workers<\/td><td>Keeps response times steady<\/td><\/tr><tr><td>pm.max_spare_servers<\/td><td>Maximum idle workers<\/td><td>Prevents idle processes from eating memory<\/td><\/tr><tr><td>pm.max_children<\/td><td>Total PHP workers allowed<\/td><td>Defines how many requests PHP can handle at once<\/td><\/tr><tr><td>pm.max_requests<\/td><td>Requests each worker handles before restart<\/td><td>Keeps long-running processes clean<\/td><\/tr><\/tbody><\/table><\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How I Usually Tune It<\/strong><\/h3>\n\n\n\n<p>When I tune PHP-FPM, I don\u2019t change everything at once. That\u2019s a recipe for chaos. Here\u2019s what I do:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Make one small change.<\/li>\n\n\n\n<li>Watch the metrics for a few hours.<\/li>\n\n\n\n<li>Run a light load test.<\/li>\n\n\n\n<li>If I see timeouts or 502s, I adjust again.<\/li>\n<\/ol>\n\n\n\n<p>It\u2019s a <a href=\"https:\/\/www.supportpro.com\/blog\/how-to-ensure-server-scalability\/\" title=\"\">balancing <\/a>act, too few workers and requests queue up, too many and your server starts to choke. You\u2019ll know you\u2019ve hit the sweet spot when the CPU graph looks calm and response times flatten out.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Don\u2019t Forget Caching<\/strong><\/h2>\n\n\n\n<p>No matter how perfectly you tune PHP, there\u2019s a point where caching will save your life. RunCloud\u2019s built-in caching (page, object, and Redis) can cut PHP load dramatically. If you haven\u2019t turned it on yet, do that before diving deep into micro-optimizations. It\u2019s the simplest fix for high CPU load in 90% of cases.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Final Thoughts<\/strong><\/h2>\n\n\n\n<p>Tuning PHP and FPM isn\u2019t glamorous. It\u2019s not something your users ever see, but they\u2019ll <em>feel<\/em> it. Pages load faster, checkout flows stop breaking, and the server doesn\u2019t groan under traffic anymore. My biggest piece of advice: <strong>change one thing at a time<\/strong>. Keep notes. Reboot when needed. RunCloud makes that process painless, so take advantage of it.<\/p>\n\n\n\n<p>If you ever hit a wall or just want a second opinion, our <a href=\"https:\/\/www.supportpro.com\/emergency-new.php\" title=\"\">team\u2019s<\/a> always around to review your configuration and help fine-tune it for your workload. Sometimes, it only takes one small setting to turn a sluggish app into a smooth one.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">FAQ<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>1. What is PHP-FPM and why is it important?<\/strong><\/h4>\n\n\n\n<p>PHP-FPM manages PHP processes and handles incoming requests efficiently, helping your website perform better under different traffic levels.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>2. Which PHP setting affects script timeouts the most?<\/strong><\/h4>\n\n\n\n<p>The <code>max_execution_time<\/code> setting controls how long a script can run before PHP stops it, making it critical for long-running tasks.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>3. How does memory_limit impact website performance?<\/strong><\/h4>\n\n\n\n<p>The memory_limit defines how much RAM each PHP process can use. Proper tuning prevents crashes while keeping server resources balanced.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>4. Which PHP-FPM mode should I use?<\/strong><\/h4>\n\n\n\n<p>Use Dynamic mode for most websites, On-Demand for low traffic, and Static for high, consistent traffic environments.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>5. Does caching help reduce PHP load?<\/strong><\/h4>\n\n\n\n<p>Yes, caching reduces the number of PHP executions, significantly lowering server load and improving response times.<\/p>\n\n\n\n<p class=\"has-white-background-color has-background\">If you need help with WebApp optimization on RunCloud, <strong><a href=\"https:\/\/www.supportpro.com\/softwareinstallation.php\" title=\"\">our expert support team is here to assist you<\/a><\/strong>. Feel free to <strong>contact us<\/strong> for any troubleshooting or guidance.<\/p>\n\n\n\n<div class=\"wp-block-media-text alignwide has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center has-white-background-color has-background\"><div class=\"wp-block-media-text__content\">\n<p class=\"has-large-font-size\">Facing issues? <\/p>\n\n\n\n<p class=\"has-large-font-size\">Our technical support<br>engineers can solve it. <\/p>\n\n\n\n<!--HubSpot Call-to-Action Code --><span class=\"hs-cta-wrapper\" id=\"hs-cta-wrapper-3350a795-db50-482f-9911-301930d1b1be\"><span class=\"hs-cta-node hs-cta-3350a795-db50-482f-9911-301930d1b1be\" id=\"hs-cta-3350a795-db50-482f-9911-301930d1b1be\"><!--[if lte IE 8]><div id=\"hs-cta-ie-element\"><\/div><![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/3350a795-db50-482f-9911-301930d1b1be\" ><img decoding=\"async\" class=\"hs-cta-img\" id=\"hs-cta-img-3350a795-db50-482f-9911-301930d1b1be\" style=\"border-width:0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/3350a795-db50-482f-9911-301930d1b1be.png\"  alt=\"Contact Us today!\"\/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '3350a795-db50-482f-9911-301930d1b1be', {\"useNewLoader\":\"true\",\"region\":\"na1\"}); <\/script><\/span><!-- end HubSpot Call-to-Action Code -->\n<\/div><figure class=\"wp-block-media-text__media\"><img fetchpriority=\"high\" decoding=\"async\" width=\"904\" height=\"931\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png\" alt=\"guy server checkup\" class=\"wp-image-12943 size-full\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png 904w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-291x300.png 291w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-768x791.png 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-585x602.png 585w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you\u2019ve ever had a website slow down the moment traffic picks up, you\u2019ll know how helpless that feels. You open the dashboard, refresh the monitor, maybe even restart the&hellip;<\/p>\n","protected":false},"author":4,"featured_media":14919,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[370,4],"tags":[],"class_list":["post-14440","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-runcloud","category-server-security"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/14440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=14440"}],"version-history":[{"count":3,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/14440\/revisions"}],"predecessor-version":[{"id":16158,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/14440\/revisions\/16158"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media\/14919"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=14440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=14440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=14440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}