From acccb94bf6438f3c7cb77ca413f1a52bf5e1ff6e Mon Sep 17 00:00:00 2001 From: Petr Menšík Date: Mar 23 2022 11:31:34 +0000 Subject: Add basic support for nginx Nginx is popular server and great for static content. Add rules for its default configuration. --- diff --git a/nginx-web-assets.conf b/nginx-web-assets.conf new file mode 100644 index 0000000..6b2b0d0 --- /dev/null +++ b/nginx-web-assets.conf @@ -0,0 +1,21 @@ +# allow access to /.sysassets + +location /.sysassets/fonts { + alias /usr/share/fonts; + autoindex off; +} + +location /.sysassets/javascript { + alias /usr/share/javascript; + autoindex off; +} + +location /.sysassets/js { + alias /usr/share/javascript; + autoindex off; +} + +location /.sysassets/ { + alias /usr/share/web-assets; + autoindex off; +} diff --git a/web-assets.spec b/web-assets.spec index 5063c7a..5913787 100644 --- a/web-assets.spec +++ b/web-assets.spec @@ -1,10 +1,11 @@ #disable the httpd stuff while we're waiting on getting the path issues #cleared up %global enable_httpd 1 +%bcond_without nginx Name: web-assets Version: 5 -Release: 14%{?dist} +Release: 15%{?dist} Summary: A simple framework for bits pushed to browsers BuildArch: noarch @@ -15,6 +16,7 @@ Source1: LICENSE Source2: macros.web-assets Source3: web-assets.conf Source4: README.devel +Source5: nginx-web-assets.conf %description %{summary}. @@ -48,6 +50,17 @@ Requires(postun): systemd %{summary}. %endif +%if %{with nginx} +%package nginx +Summary: Web Assets aliases for the nginx daemon +License: MIT +Requires: web-assets-filesystem = %{version}-%{release} +Requires: nginx + +%description nginx +%{summary}. +%endif + %prep %setup -c -T cp %{SOURCE1} LICENSE @@ -66,6 +79,10 @@ ln -sf ../fonts %{buildroot}%{_datadir}/web-assets/fonts install -Dpm0644 %{SOURCE2} %{buildroot}%{_rpmconfigdir}/macros.d/macros.web-assets +%if %{with nginx} +install -Dpm0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/nginx/default.d/web-assets.conf +%endif + %if 0%{?enable_httpd} install -Dpm0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/httpd/conf.d/web-assets.conf @@ -76,21 +93,40 @@ systemctl reload-or-try-restart httpd.service || : systemctl reload-or-try-restart httpd.service || : %endif + +%if %{with nginx} +%post nginx +[ -x %{_bindir}/systemctl ] && systemctl reload-or-try-restart nginx.service || : + +%postun nginx +[ -x %{_bindir}/systemctl ] && systemctl reload-or-try-restart nginx.service || : +%endif + %files filesystem %{_datadir}/web-assets %{_datadir}/javascript %files devel %{_rpmconfigdir}/macros.d/macros.web-assets -%doc LICENSE README.devel +%license LICENSE +%doc README.devel %if 0%{?enable_httpd} %files httpd %config(noreplace) %{_sysconfdir}/httpd/conf.d/web-assets.conf -%doc LICENSE +%license LICENSE +%endif + +%if %{with nginx} +%files nginx +%config(noreplace) %{_sysconfdir}/nginx/default.d/web-assets.conf +%license LICENSE %endif %changelog +* Tue Mar 22 2022 Petr Menšík - 5-15 +- Add nginx aliases support + * Fri Jul 23 2021 Fedora Release Engineering - 5-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild