angristan / angristan/nginx-autoinstall

Enhancement suggestion: for PageSpeed, automatically create cache directory

Ouverte
#89 3 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
enhancement need feeback
Langage dominant
Shell
Étoiles
646
Forks
231
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Hi there! First of all: _awesome_ script, I found it by mere chance, and it works so flawlessly that it's actually scary...

Now for a suggestion — I've mostly used this script to add `pagespeed` & `brotli` support on `nginx`. `pagespeed` in particular has a gazillion options, but one that pretty much everyone will be using is, obviously, adding the cache directory.

By convention — and your script follows this convention! — `/var/ngx_pagespeed_cache` is the default. However, a common configuration change (at least on Ubuntu/Debian) is to use a `tmpfs`-mounted directory for the cache, say, `/run/ngx_pagespeed_cache` (and just use a symlink to keep the rest of the default configuration working).

This has a problem: when rebooting, as expected, the content of `/run` will be lost, and when `nginx` starts, it expects `/run/ngx_pagespeed_cache` to exist, and because it doesn't exist any more (just a broken symlink pointing to it), `nginx` will fail to run.

On systems using `systemd`, one simple solution is to add a small file under `/usr/lib/tmpfiles.d`, which will tell the system what to create when starting up. In fact, a lot of packages (`mysql`, `php-fpm`, among so many others...) use this method to set up sockets, for example, which are conveniently created on a `tmpfs` volume for added speed.

It would be nice if a future version of `nginx-autoinstall` would be able to create something like that automatically, e.g.:

```
echo "d /run/ngx_pagespeed_cache 0755 www-data www-data - -" > /usr/lib/tmpfiles.d/nginx.conf
ln -s /run/ngx_pagespeed_cache /var/ngx_pagespeed_cache
```

This could be one of the (many) extra options for those interested in having a `tmpfs`-based cache for `pagespeed`...

Keep updating `nginx-autoinstall`, great job so far, and thanks again!

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.