{"id":35012,"date":"2023-12-18T16:00:17","date_gmt":"2023-12-18T16:00:17","guid":{"rendered":"https:\/\/airoserver.com\/?p=35012"},"modified":"2023-12-16T10:16:50","modified_gmt":"2023-12-16T10:16:50","slug":"how-to-clear-cache-in-nginx","status":"publish","type":"post","link":"https:\/\/airoserver.com\/fa\/airoserver\/how-to-clear-cache-in-nginx\/","title":{"rendered":"How to clear cache in Nginx"},"content":{"rendered":"<h3><strong>How to clear cache in Nginx<\/strong><\/h3>\n<p>There are two general and easy methods to clear the cache in Nginx, which we intend to study together in the following article.<\/p>\n<h3><strong>What is cache and what is its use?<\/strong><\/h3>\n<p>When a web server serves a web page, it stores a copy of that web page in its cache, which is call a cache.<\/p>\n<p>This allows the server to quickly serve the same web page to subsequent visitors without having to rebuild it.<\/p>\n<p>Generally, this is because it improves website performance and reduces the load on the server. However, the cache may become outdated over time and you may need to delete it.<\/p>\n<h4><strong>How to clear the Nginx cache<\/strong><\/h4>\n<p>Clearing the cache in this web server is done in two ways:<\/p>\n<ul>\n<li>Using the command line<\/li>\n<li>Manually delete cache files<\/li>\n<\/ul>\n<h4><strong>Clear the Nginx cache using the command line<\/strong><\/h4>\n<p>This method is the easiest way to clear this web server cache. This is possible by using the &#8220;nginx -s reload&#8221; command.<\/p>\n<p>This command sends a signal to the Nginx main process to reload the configuration and flush the cache. This is useful when you have made changes to your website and want the changes to take effect immediately without waiting for the cache to expire.<\/p>\n<h3><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-35039 size-full\" src=\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-2-4.jpg\" alt=\"Nginx\" width=\"1024\" height=\"550\" srcset=\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-2-4.jpg 1024w, https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-2-4-300x161.jpg 300w, https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-2-4-768x413.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/strong><\/h3>\n<p><strong>\u00a0<\/strong><\/p>\n<h3><strong>Clear Nginx cache by manual deletion method<\/strong><\/h3>\n<p>Another way to clear this web server cache is to manually delete the cache files.<\/p>\n<p>To delete cache files manually, you must first find the folder where Nginx cache files are store. These files are usually located in the &#8220;\/var\/cache\/nginx\/&#8221; folder.<\/p>\n<p>Once you find the cache folder, you can use the command &#8220;rm -rf&#8221; to delete all the files and folders inside it.<\/p>\n<p>Of course, you should be very careful when doing this, because this will delete all the cache files and may affect the performance of your website.<\/p>\n<p>Additionally, some Nginx configurations may have a different cache directory location, you can check the nginx.conf file or ask your system administrator where the cache directory is located.<\/p>\n<p>In any case, it is recommended to restart this web server after clearing the cache to make sure the changes are applied. You can do this by using the command &#8220;systemctl restart nginx&#8221; in the command line.<\/p>\n<p>Finally, clearing this web server cache can done using the command &#8220;nginx -s reload&#8221; or by manually deleting the cache files.<\/p>\n<p>It is also important to remember that clearing the cache may affect the performance of your website. Therefore, it is always recommend that you make a backup copy of your files before starting.<\/p>\n<p>Note: Before executing any command, make sure you are log in as a superuser or use the sudo command to avoid any permission problems.<\/p>","protected":false},"excerpt":{"rendered":"<p>How to clear cache in Nginx There are two general and easy methods to clear the cache in Nginx, which we intend to study together in the following article. What is cache and what is its use? When a web server serves a web page, it stores a copy of that web page in its [&hellip;]<\/p>","protected":false},"author":26,"featured_media":35040,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[179,1],"tags":[],"class_list":["post-35012","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-airoserver","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to clear cache in Nginx - Airoserver | Cloud Hosting Solutions<\/title>\n<meta name=\"description\" content=\"There are two general and easy methods to clear the cache in Nginx, which we intend to study together in the following article.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/airoserver.com\/fa\/airoserver\/how-to-clear-cache-in-nginx\/\" \/>\n<meta property=\"og:locale\" content=\"fa_IR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to clear cache in Nginx - Airoserver | Cloud Hosting Solutions\" \/>\n<meta property=\"og:description\" content=\"There are two general and easy methods to clear the cache in Nginx, which we intend to study together in the following article.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/airoserver.com\/fa\/airoserver\/how-to-clear-cache-in-nginx\/\" \/>\n<meta property=\"og:site_name\" content=\"Airoserver | Cloud Hosting Solutions\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-18T16:00:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-16T10:16:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-1-4.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"550\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Codinoob\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u0646\u0648\u0634\u062a\u0647\u200c\u0634\u062f\u0647 \u0628\u062f\u0633\u062a\" \/>\n\t<meta name=\"twitter:data1\" content=\"Codinoob\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u0632\u0645\u0627\u0646 \u062a\u0642\u0631\u06cc\u0628\u06cc \u0628\u0631\u0627\u06cc \u062e\u0648\u0627\u0646\u062f\u0646\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u062f\u0642\u06cc\u0642\u0647\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/\"},\"author\":{\"name\":\"Codinoob\",\"@id\":\"https:\/\/airoserver.com\/#\/schema\/person\/98c9f3c9d2d2baaf929d2c4a53462e97\"},\"headline\":\"How to clear cache in Nginx\",\"datePublished\":\"2023-12-18T16:00:17+00:00\",\"dateModified\":\"2023-12-16T10:16:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/\"},\"wordCount\":458,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/airoserver.com\/#organization\"},\"articleSection\":[\"AiroServer\",\"Blog\"],\"inLanguage\":\"fa-IR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/\",\"url\":\"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/\",\"name\":\"How to clear cache in Nginx - Airoserver | Cloud Hosting Solutions\",\"isPartOf\":{\"@id\":\"https:\/\/airoserver.com\/#website\"},\"datePublished\":\"2023-12-18T16:00:17+00:00\",\"dateModified\":\"2023-12-16T10:16:50+00:00\",\"description\":\"There are two general and easy methods to clear the cache in Nginx, which we intend to study together in the following article.\",\"breadcrumb\":{\"@id\":\"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/#breadcrumb\"},\"inLanguage\":\"fa-IR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/airoserver.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to clear cache in Nginx\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/airoserver.com\/#website\",\"url\":\"https:\/\/airoserver.com\/\",\"name\":\"Airoserver | Cloud Hosting Solutions\",\"description\":\"Cloud server | Dedicated server | Domain | Hosting| SSL | Virtual server | Airoserver\",\"publisher\":{\"@id\":\"https:\/\/airoserver.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/airoserver.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"fa-IR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/airoserver.com\/#organization\",\"name\":\"Airoserver | Cloud Hosting Solutions\",\"url\":\"https:\/\/airoserver.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fa-IR\",\"@id\":\"https:\/\/airoserver.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/09\/logo_airoserver.png\",\"contentUrl\":\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/09\/logo_airoserver.png\",\"width\":925,\"height\":880,\"caption\":\"Airoserver | Cloud Hosting Solutions\"},\"image\":{\"@id\":\"https:\/\/airoserver.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/airoserver.com\/#\/schema\/person\/98c9f3c9d2d2baaf929d2c4a53462e97\",\"name\":\"Codinoob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fa-IR\",\"@id\":\"https:\/\/airoserver.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/016ea0daadd857a2718a67b0e8afc43ac449be1b2c2945db2414893811a00a97?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/016ea0daadd857a2718a67b0e8afc43ac449be1b2c2945db2414893811a00a97?s=96&d=mm&r=g\",\"caption\":\"Codinoob\"},\"sameAs\":[\"http:\/\/codinoob.ir\"],\"url\":\"https:\/\/airoserver.com\/fa\/author\/codinoob\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to clear cache in Nginx - Airoserver | Cloud Hosting Solutions","description":"There are two general and easy methods to clear the cache in Nginx, which we intend to study together in the following article.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/airoserver.com\/fa\/airoserver\/how-to-clear-cache-in-nginx\/","og_locale":"fa_IR","og_type":"article","og_title":"How to clear cache in Nginx - Airoserver | Cloud Hosting Solutions","og_description":"There are two general and easy methods to clear the cache in Nginx, which we intend to study together in the following article.","og_url":"https:\/\/airoserver.com\/fa\/airoserver\/how-to-clear-cache-in-nginx\/","og_site_name":"Airoserver | Cloud Hosting Solutions","article_published_time":"2023-12-18T16:00:17+00:00","article_modified_time":"2023-12-16T10:16:50+00:00","og_image":[{"width":1024,"height":550,"url":"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-1-4.jpg","type":"image\/jpeg"}],"author":"Codinoob","twitter_card":"summary_large_image","twitter_misc":{"\u0646\u0648\u0634\u062a\u0647\u200c\u0634\u062f\u0647 \u0628\u062f\u0633\u062a":"Codinoob","\u0632\u0645\u0627\u0646 \u062a\u0642\u0631\u06cc\u0628\u06cc \u0628\u0631\u0627\u06cc \u062e\u0648\u0627\u0646\u062f\u0646":"3 \u062f\u0642\u06cc\u0642\u0647"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/#article","isPartOf":{"@id":"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/"},"author":{"name":"Codinoob","@id":"https:\/\/airoserver.com\/#\/schema\/person\/98c9f3c9d2d2baaf929d2c4a53462e97"},"headline":"How to clear cache in Nginx","datePublished":"2023-12-18T16:00:17+00:00","dateModified":"2023-12-16T10:16:50+00:00","mainEntityOfPage":{"@id":"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/"},"wordCount":458,"commentCount":0,"publisher":{"@id":"https:\/\/airoserver.com\/#organization"},"articleSection":["AiroServer","Blog"],"inLanguage":"fa-IR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/","url":"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/","name":"How to clear cache in Nginx - Airoserver | Cloud Hosting Solutions","isPartOf":{"@id":"https:\/\/airoserver.com\/#website"},"datePublished":"2023-12-18T16:00:17+00:00","dateModified":"2023-12-16T10:16:50+00:00","description":"There are two general and easy methods to clear the cache in Nginx, which we intend to study together in the following article.","breadcrumb":{"@id":"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/#breadcrumb"},"inLanguage":"fa-IR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/airoserver.com\/airoserver\/how-to-clear-cache-in-nginx\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/airoserver.com\/"},{"@type":"ListItem","position":2,"name":"How to clear cache in Nginx"}]},{"@type":"WebSite","@id":"https:\/\/airoserver.com\/#website","url":"https:\/\/airoserver.com\/","name":"Airoserver | Cloud Hosting Solutions","description":"Cloud server | Dedicated server | Domain | Hosting| SSL | Virtual server | Airoserver","publisher":{"@id":"https:\/\/airoserver.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/airoserver.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"fa-IR"},{"@type":"Organization","@id":"https:\/\/airoserver.com\/#organization","name":"Airoserver | Cloud Hosting Solutions","url":"https:\/\/airoserver.com\/","logo":{"@type":"ImageObject","inLanguage":"fa-IR","@id":"https:\/\/airoserver.com\/#\/schema\/logo\/image\/","url":"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/09\/logo_airoserver.png","contentUrl":"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/09\/logo_airoserver.png","width":925,"height":880,"caption":"Airoserver | Cloud Hosting Solutions"},"image":{"@id":"https:\/\/airoserver.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/airoserver.com\/#\/schema\/person\/98c9f3c9d2d2baaf929d2c4a53462e97","name":"Codinoob","image":{"@type":"ImageObject","inLanguage":"fa-IR","@id":"https:\/\/airoserver.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/016ea0daadd857a2718a67b0e8afc43ac449be1b2c2945db2414893811a00a97?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/016ea0daadd857a2718a67b0e8afc43ac449be1b2c2945db2414893811a00a97?s=96&d=mm&r=g","caption":"Codinoob"},"sameAs":["http:\/\/codinoob.ir"],"url":"https:\/\/airoserver.com\/fa\/author\/codinoob\/"}]}},"_links":{"self":[{"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/posts\/35012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/comments?post=35012"}],"version-history":[{"count":0,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/posts\/35012\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/media\/35040"}],"wp:attachment":[{"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/media?parent=35012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/categories?post=35012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/tags?post=35012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}