Wednesday, March 22, 2023
  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Podcasts
  • Web Hosting Directory
  • Login
  • Register
Cloud7 News
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Software
    • Network/Internet
    • Hardware
    • Artificial Intelligence
    • Windows
    • Policy/Legislation
    • Blockchain
    • Troubleshooting
    • How-Tos
    • Articles
No Result
View All Result
Cloud7 News
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Software
    • Network/Internet
    • Hardware
    • Artificial Intelligence
    • Windows
    • Policy/Legislation
    • Blockchain
    • Troubleshooting
    • How-Tos
    • Articles
No Result
View All Result
Cloud7 News
No Result
View All Result

Home > How-Tos > How to clear the cache on Nginx

How to clear the cache on Nginx

There are two easy ways to clear the cache on Nginx, let's take a closer look at these two methods to clear the cache on Nginx.


Erdem Yasar Erdem Yasar
February 11, 2023
2 min read
Clear cache on Nginx

When a web server serves a webpage, it stores a copy of the webpage in its cache. This allows the server to quickly serve the same webpage to subsequent visitors without having to regenerate it. This improves the performance of the website and reduces the load on the server. However, over time, the cache can become outdated, and it may be necessary to clear it.

Clearing the cache of Nginx web server can be done in two ways: using the command line or manually deleting the cache files.

Using the command line

The most convenient way to clear the cache of Nginx web server is by using the command “nginx -s reload”. This command sends a signal to the Nginx master process to reload the configuration and clear the cache. This is useful when you have made changes to your website, and you want the changes to take effect immediately without waiting for the cache to expire.

nginx -s reload

Manually deleting cache files

Another way to clear the cache of Nginx web server is by manually deleting the cache files. Nginx stores the cache files in the “/var/cache/nginx/” folder. This folder contains subfolders for each website, and inside each subfolder, there are files that represent the cached pages. By deleting these files, you can clear the cache of a specific website. However, be aware that this method will delete all cache files and may affect the performance of your website.

To manually delete cache files, first, you need to locate the folder where the Nginx cache files are stored. These files are usually located in the “/var/cache/nginx/” folder.

ls /var/cache/nginx/

Once you have located the cache folder, you can use the command “rm -rf” to delete all the files and folders inside it. Be careful when doing this, as it will delete all cache files and may affect the performance of your website.

rm -rf /var/cache/nginx/*

Additionally, some Nginx configurations may have different cache directory location, you can check nginx.conf file or ask your system administrator where the cache directory located.

In any case, after clearing the cache, it is recommended to restart the Nginx web server to ensure that the changes take effect. You can do this by using the command “systemctl restart nginx” on the command line.

systemctl restart nginx

In conclusion, clearing the cache of Nginx web server can be done by using the command “nginx -s reload” or by manually deleting the cache files. It’s important to keep in mind that clearing the cache may affect the performance of your website. Therefore, it is always recommended to take a backup of your files before starting.

Note: Before you execute any command make sure you’re logged in as a superuser or use ‘sudo’ command to avoid any permission issues.

Erdem Yasar

Erdem Yasar

Erdem Yasar is a news editor at Cloud7. Erdem started his career by writing video game reviews in 2007 for PC World magazine while he was studying computer engineering. In the following years, he focused on software development with various programming languages. After his graduation, he continued to work as an editor for several major tech-related websites and magazines. During the 2010s, Erdem Yasar shifted his focus to cloud computing, hosting, and data centers as they were becoming more popular topics in the tech industry. Erdem Yasar also worked with various industry-leading tech companies as a content creator by writing blog posts and other articles. Prior to his role at Cloud7, Erdem was the managing editor of T3 Magazine.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

Next Post
Weekly round-up 6 – 10 February

Weekly round-up: 6 – 10 February

Related News

Learn how to install GE-Proton on Steam Play using the ProtonUp-Qt app

How to install GE-Proton on Steam Play using the ProtonUp-Qt app

March 14, 2023 3:15 pm
How to create a song with AIVA for free

How to create a song with AIVA for free?

March 13, 2023 5:50 pm
DALL-E guide how to get the best use out of AI

DALL-E guide: How to get the best use out of AI

March 11, 2023 3:00 pm
How to find the page ID in WordPress

How to find the page ID in WordPress

March 5, 2023 8:00 pm
Get free daily newsletters from Cloud7 News Get the Cloud7 Newsletter
Select list(s):

Check your inbox or spam folder to confirm your subscription.

By subscribing, you agree to our
Copyright Policy and Privacy Policy

Get the free newsletter

Subscribe to receive the latest IT business updates straight to your inbox.

Select list(s):

Check your inbox or spam folder to confirm your subscription.

Recent News

  • 7 best cyber security schools
  • 7 oldest Linux distros that are still being maintained
  • OVHcloud purchases its first Quandela quantum computer
  • Leil Storage launches an innovative data storage solution
  • Tails 5.11 is released, download it now

Cloud7 News
Cloud7 is a news source that publishes the latest news, reviews, comparisons, opinions, and exclusive interviews to help tech users of high-experience levels in the IT industry.

EXPLORE

  • Web Hosting
  • Cloud Computing
  • Data Center
  • Cybersecurity
  • Linux
  • Network/Internet
  • Software
  • Hardware
  • Artificial Intelligence
  • How-Tos
  • Troubleshooting

RESOURCES

  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Podcasts
  • Web Hosting Directory

Get the Cloud7 Newsletter

Get FREE daily newsletters from Cloud7 delivering the latest news and reviews.

  • About Us
  • Privacy & Policy
  • Copyright Policy
  • Contact

© 2023, Cloud7 News. All rights reserved.

No Result
View All Result
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Software
    • Network/Internet
    • Hardware
    • Artificial Intelligence
    • Windows
    • Policy/Legislation
    • Blockchain
    • Troubleshooting
    • How-Tos
    • Articles
  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Podcasts
  • Web Hosting Directory

© 2023, Cloud7 News. All rights reserved.

Welcome Back!

Sign In with Facebook
Sign In with Google
Sign In with Linked In
OR

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Sign Up with Facebook
Sign Up with Google
Sign Up with Linked In
OR

Fill the forms below to register

*By registering into our website, you agree to the Terms & Conditions and Privacy Policy.
All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In

Add New Playlist

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.