mirror of
https://github.com/TrentSPalmer/trentdocs_website.git
synced 2024-11-23 08:01:30 -08:00
extend docs/dynamic_cacheing_nginx_reverse_proxy_for_pacman.md
This commit is contained in:
parent
c7b05df1c2
commit
27b6330edd
@ -41,7 +41,7 @@ You can start with a default `/etc/nginx/nginx.conf`,
|
|||||||
and add the line `include sites-enabled/*;`
|
and add the line `include sites-enabled/*;`
|
||||||
at the end of the *http* section.
|
at the end of the *http* section.
|
||||||
|
|
||||||
```text
|
```nginx
|
||||||
# /etc/nginx/nginx.conf
|
# /etc/nginx/nginx.conf
|
||||||
#user html;
|
#user html;
|
||||||
worker_processes 1;
|
worker_processes 1;
|
||||||
@ -181,12 +181,12 @@ ip address instead, then that should match what you write in your mirrorlist.
|
|||||||
And of course your mirrorlist entry
|
And of course your mirrorlist entry
|
||||||
on the client machine, has to preserve the directory scheme.
|
on the client machine, has to preserve the directory scheme.
|
||||||
|
|
||||||
```text
|
```conf
|
||||||
# /etc/pacman.d/mirrorlist
|
# /etc/pacman.d/mirrorlist
|
||||||
Server = http://<hostname or ip address>:<port if not 80>/archlinux/$repo/os/$arch
|
Server = http://<hostname or ip address>:<port if not 80>/archlinux/$repo/os/$arch
|
||||||
```
|
```
|
||||||
|
|
||||||
```text
|
```nginx
|
||||||
# /etc/nginx/sites-enabled/proxy_cache.conf
|
# /etc/nginx/sites-enabled/proxy_cache.conf
|
||||||
# nginx may need to resolve domain names at run time
|
# nginx may need to resolve domain names at run time
|
||||||
resolver 8.8.8.8 8.8.4.4;
|
resolver 8.8.8.8 8.8.4.4;
|
||||||
@ -282,7 +282,7 @@ systemctl enable/start /etc/systemd/system/proxy_cache_clean.timer
|
|||||||
|
|
||||||
Keeps the 2 most recent versions of each package using paccache command.
|
Keeps the 2 most recent versions of each package using paccache command.
|
||||||
|
|
||||||
```text
|
```conf
|
||||||
# /etc/systemd/system/proxy_cache_clean.service
|
# /etc/systemd/system/proxy_cache_clean.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Clean The pacman proxy cache
|
Description=Clean The pacman proxy cache
|
||||||
@ -296,7 +296,7 @@ StandardError=syslog
|
|||||||
|
|
||||||
## systemd timer for the systemd service that cleans the proxy cache
|
## systemd timer for the systemd service that cleans the proxy cache
|
||||||
|
|
||||||
```text
|
```conf
|
||||||
# /etc/systemd/system/proxy_cache_clean.timer
|
# /etc/systemd/system/proxy_cache_clean.timer
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Timer for clean The pacman proxy cache
|
Description=Timer for clean The pacman proxy cache
|
||||||
@ -323,7 +323,7 @@ the database files, then you'll just be stuck with old database files, unless
|
|||||||
you periodically delete them. But I'm not sure about all this, will keep an
|
you periodically delete them. But I'm not sure about all this, will keep an
|
||||||
eye on things.
|
eye on things.
|
||||||
|
|
||||||
```text
|
```conf
|
||||||
# /etc/systemd/system/proxy_cache_database_clean.service
|
# /etc/systemd/system/proxy_cache_database_clean.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Clean The pacman proxy cache database
|
Description=Clean The pacman proxy cache database
|
||||||
@ -337,7 +337,7 @@ StandardError=syslog
|
|||||||
|
|
||||||
## systemd timer for the systemd service that deletes the pacman database files from the proxy cache
|
## systemd timer for the systemd service that deletes the pacman database files from the proxy cache
|
||||||
|
|
||||||
```text
|
```conf
|
||||||
# /etc/systemd/system/proxy_cache_database_clean.timer
|
# /etc/systemd/system/proxy_cache_database_clean.timer
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Timer for clean The pacman proxy cache database
|
Description=Timer for clean The pacman proxy cache database
|
||||||
@ -350,3 +350,12 @@ Unit=proxy_cache_database_clean.service
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=timers.target
|
WantedBy=timers.target
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## If you prefer cron because the server is actually an ubuntu:16.04 LXD container
|
||||||
|
Make sure single quote in the command here.
|
||||||
|
|
||||||
|
```cron
|
||||||
|
#!/bin/bash
|
||||||
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
|
||||||
|
5,20,35,50 * * * * /bin/bash -c 'for f in $(find /var/www/html/pacman-cache -name *db) ; do rm $f; done'
|
||||||
|
```
|
||||||
|
@ -108,6 +108,8 @@
|
|||||||
|
|
||||||
<li><a class="toctree-l3" href="#systemd-timer-for-the-systemd-service-that-deletes-the-pacman-database-files-from-the-proxy-cache">systemd timer for the systemd service that deletes the pacman database files from the proxy cache</a></li>
|
<li><a class="toctree-l3" href="#systemd-timer-for-the-systemd-service-that-deletes-the-pacman-database-files-from-the-proxy-cache">systemd timer for the systemd service that deletes the pacman database files from the proxy cache</a></li>
|
||||||
|
|
||||||
|
<li><a class="toctree-l3" href="#if-you-prefer-cron-because-the-server-is-actually-an-ubuntu1604-lxd-container">If you prefer cron because the server is actually an ubuntu:16.04 LXD container</a></li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
@ -203,7 +205,7 @@ working as of July 2017 with a fresh install of nginx.</p>
|
|||||||
<p>You can start with a default <code>/etc/nginx/nginx.conf</code>,
|
<p>You can start with a default <code>/etc/nginx/nginx.conf</code>,
|
||||||
and add the line <code>include sites-enabled/*;</code>
|
and add the line <code>include sites-enabled/*;</code>
|
||||||
at the end of the <em>http</em> section.</p>
|
at the end of the <em>http</em> section.</p>
|
||||||
<pre><code class="text"># /etc/nginx/nginx.conf
|
<pre><code class="nginx"># /etc/nginx/nginx.conf
|
||||||
#user html;
|
#user html;
|
||||||
worker_processes 1;
|
worker_processes 1;
|
||||||
|
|
||||||
@ -337,11 +339,11 @@ have to assign static ip addresses and explicitly write the local
|
|||||||
ip address instead, then that should match what you write in your mirrorlist.</p>
|
ip address instead, then that should match what you write in your mirrorlist.</p>
|
||||||
<p>And of course your mirrorlist entry
|
<p>And of course your mirrorlist entry
|
||||||
on the client machine, has to preserve the directory scheme.</p>
|
on the client machine, has to preserve the directory scheme.</p>
|
||||||
<pre><code class="text"># /etc/pacman.d/mirrorlist
|
<pre><code class="conf"># /etc/pacman.d/mirrorlist
|
||||||
Server = http://<hostname or ip address>:<port if not 80>/archlinux/$repo/os/$arch
|
Server = http://<hostname or ip address>:<port if not 80>/archlinux/$repo/os/$arch
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<pre><code class="text"># /etc/nginx/sites-enabled/proxy_cache.conf
|
<pre><code class="nginx"># /etc/nginx/sites-enabled/proxy_cache.conf
|
||||||
# nginx may need to resolve domain names at run time
|
# nginx may need to resolve domain names at run time
|
||||||
resolver 8.8.8.8 8.8.4.4;
|
resolver 8.8.8.8 8.8.4.4;
|
||||||
|
|
||||||
@ -432,7 +434,7 @@ server
|
|||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<p>Keeps the 2 most recent versions of each package using paccache command.</p>
|
<p>Keeps the 2 most recent versions of each package using paccache command.</p>
|
||||||
<pre><code class="text"># /etc/systemd/system/proxy_cache_clean.service
|
<pre><code class="conf"># /etc/systemd/system/proxy_cache_clean.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Clean The pacman proxy cache
|
Description=Clean The pacman proxy cache
|
||||||
|
|
||||||
@ -444,7 +446,7 @@ StandardError=syslog
|
|||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<h2 id="systemd-timer-for-the-systemd-service-that-cleans-the-proxy-cache">systemd timer for the systemd service that cleans the proxy cache</h2>
|
<h2 id="systemd-timer-for-the-systemd-service-that-cleans-the-proxy-cache">systemd timer for the systemd service that cleans the proxy cache</h2>
|
||||||
<pre><code class="text"># /etc/systemd/system/proxy_cache_clean.timer
|
<pre><code class="conf"># /etc/systemd/system/proxy_cache_clean.timer
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Timer for clean The pacman proxy cache
|
Description=Timer for clean The pacman proxy cache
|
||||||
|
|
||||||
@ -466,7 +468,7 @@ WantedBy=timers.target
|
|||||||
the database files, then you'll just be stuck with old database files, unless
|
the database files, then you'll just be stuck with old database files, unless
|
||||||
you periodically delete them. But I'm not sure about all this, will keep an
|
you periodically delete them. But I'm not sure about all this, will keep an
|
||||||
eye on things.</p>
|
eye on things.</p>
|
||||||
<pre><code class="text"># /etc/systemd/system/proxy_cache_database_clean.service
|
<pre><code class="conf"># /etc/systemd/system/proxy_cache_database_clean.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Clean The pacman proxy cache database
|
Description=Clean The pacman proxy cache database
|
||||||
|
|
||||||
@ -478,7 +480,7 @@ StandardError=syslog
|
|||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<h2 id="systemd-timer-for-the-systemd-service-that-deletes-the-pacman-database-files-from-the-proxy-cache">systemd timer for the systemd service that deletes the pacman database files from the proxy cache</h2>
|
<h2 id="systemd-timer-for-the-systemd-service-that-deletes-the-pacman-database-files-from-the-proxy-cache">systemd timer for the systemd service that deletes the pacman database files from the proxy cache</h2>
|
||||||
<pre><code class="text"># /etc/systemd/system/proxy_cache_database_clean.timer
|
<pre><code class="conf"># /etc/systemd/system/proxy_cache_database_clean.timer
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Timer for clean The pacman proxy cache database
|
Description=Timer for clean The pacman proxy cache database
|
||||||
|
|
||||||
@ -489,6 +491,13 @@ Unit=proxy_cache_database_clean.service
|
|||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=timers.target
|
WantedBy=timers.target
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h2 id="if-you-prefer-cron-because-the-server-is-actually-an-ubuntu1604-lxd-container">If you prefer cron because the server is actually an ubuntu:16.04 LXD container</h2>
|
||||||
|
<p>Make sure single quote in the command here.</p>
|
||||||
|
<pre><code class="cron">#!/bin/bash
|
||||||
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
|
||||||
|
5,20,35,50 * * * * /bin/bash -c 'for f in $(find /var/www/html/pacman-cache -name *db) ; do rm $f; done'
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -228,5 +228,5 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
MkDocs version : 0.16.3
|
MkDocs version : 0.16.3
|
||||||
Build Date UTC : 2017-07-24 06:45:41
|
Build Date UTC : 2017-07-24 10:16:29
|
||||||
-->
|
-->
|
||||||
|
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/</loc>
|
<loc>/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/apt_pinning_artful_aardvark_packages_in_xenial_xerus/</loc>
|
<loc>/apt_pinning_artful_aardvark_packages_in_xenial_xerus/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/lxd_container_home_server_networking_for_dummies/</loc>
|
<loc>/lxd_container_home_server_networking_for_dummies/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/how_to_reassign_a_static_ip_address_with_dnsmasq/</loc>
|
<loc>/how_to_reassign_a_static_ip_address_with_dnsmasq/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/serve_and_share_apps_from_your_phone_with_fdroid/</loc>
|
<loc>/serve_and_share_apps_from_your_phone_with_fdroid/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/nspawn/</loc>
|
<loc>/nspawn/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/mastodon_on_arch/</loc>
|
<loc>/mastodon_on_arch/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/debian_nspawn_container_on_arch_for_testing_apache_configurations/</loc>
|
<loc>/debian_nspawn_container_on_arch_for_testing_apache_configurations/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/dynamic_cacheing_nginx_reverse_proxy_for_pacman/</loc>
|
<loc>/dynamic_cacheing_nginx_reverse_proxy_for_pacman/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/freebsd_jails_on_freenas/</loc>
|
<loc>/freebsd_jails_on_freenas/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/arch_redis_nspawn/</loc>
|
<loc>/arch_redis_nspawn/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -92,7 +92,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/arch_postgresql_nspawn/</loc>
|
<loc>/arch_postgresql_nspawn/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -100,7 +100,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/misc_tips_troubleshooting/</loc>
|
<loc>/misc_tips_troubleshooting/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -108,7 +108,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/self_signed_certs/</loc>
|
<loc>/self_signed_certs/</loc>
|
||||||
<lastmod>2017-07-23</lastmod>
|
<lastmod>2017-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user