Add nginx cache

main
Bob Mottram 2020-05-30 20:12:02 +01:00
parent 6cf1c79cf2
commit fe21d913df
2 changed files with 12 additions and 1 deletions

View File

@ -56,6 +56,8 @@ Create a web server configuration:
And paste the following: And paste the following:
proxy_cache_path /var/www/cache levels=1:2 keys_zone=my_cache:10m max_size=10g
inactive=60m use_temp_path=off;
server { server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
@ -122,6 +124,8 @@ And paste the following:
proxy_redirect off; proxy_redirect off;
proxy_request_buffering on; proxy_request_buffering on;
proxy_buffering on; proxy_buffering on;
proxy_cache my_cache;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_pass http://localhost:7156; proxy_pass http://localhost:7156;
} }
} }
@ -129,6 +133,7 @@ And paste the following:
Enable the site: Enable the site:
ln -s /etc/nginx/sites-available/YOUR_DOMAIN /etc/nginx/sites-enabled/ ln -s /etc/nginx/sites-available/YOUR_DOMAIN /etc/nginx/sites-enabled/
mkdir /var/www/cache
Forward port 443 from your internet router to your server. If you have dynamic DNS make sure its configured. Add a TLS certificate: Forward port 443 from your internet router to your server. If you have dynamic DNS make sure its configured. Add a TLS certificate:

View File

@ -1335,6 +1335,9 @@
And paste the following: And paste the following:
</p> </p>
<div class="shell"> <div class="shell">
proxy_cache_path /var/www/cache levels=1:2 keys_zone=my_cache:10m max_size=10g
inactive=60m use_temp_path=off;
server {<br> server {<br>
listen 80;<br> listen 80;<br>
listen [::]:80;<br> listen [::]:80;<br>
@ -1401,6 +1404,8 @@
proxy_redirect off;<br> proxy_redirect off;<br>
proxy_request_buffering on;<br> proxy_request_buffering on;<br>
proxy_buffering on;<br> proxy_buffering on;<br>
proxy_cache my_cache;<br>
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;<br>
proxy_pass http://localhost:7156;<br> proxy_pass http://localhost:7156;<br>
}<br> }<br>
} }
@ -1410,7 +1415,8 @@
Enable the site: Enable the site:
</p> </p>
<div class="shell"> <div class="shell">
ln -s /etc/nginx/sites-available/YOUR_DOMAIN /etc/nginx/sites-enabled/ ln -s /etc/nginx/sites-available/YOUR_DOMAIN /etc/nginx/sites-enabled/<br>
mkdir /var/www/cache
</div> </div>
<p class="intro"> <p class="intro">