provide snippets/fastcgi-php.conf and move default site from nginx.conf to sites-available/default [release 1.21.1-3mamba;Mon Aug 30 2021]

This commit is contained in:
Silvan Calarco 2024-01-06 07:38:28 +01:00
parent c1fb0de891
commit 31192a2ac4
4 changed files with 101 additions and 4 deletions

View File

@ -1,5 +1,59 @@
--- nginx-1.21.1/conf/nginx.conf.orig 2021-08-29 11:08:19.726594969 +0200
+++ nginx-1.21.1/conf/nginx.conf 2021-08-29 11:10:19.197781120 +0200
--- nginx-1.21.1/conf/nginx.conf.orig 2021-08-30 13:43:13.100432769 +0200
+++ nginx-1.21.1/conf/nginx.conf 2021-08-30 13:50:28.498600068 +0200
@@ -32,28 +32,28 @@
#gzip on;
- server {
- listen 80;
- server_name localhost;
-
+ #server {
+ # listen 80;
+ # server_name localhost;
+ #
#charset koi8-r;
#access_log logs/host.access.log main;
-
- location / {
- root html;
- index index.html index.htm;
- }
-
+ #
+ # location / {
+ # root html;
+ # index index.html index.htm;
+ # }
+ #
#error_page 404 /404.html;
-
+ #
# redirect server error pages to the static page /50x.html
#
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
-
+ # error_page 500 502 503 504 /50x.html;
+ # location = /50x.html {
+ # root html;
+ # }
+ #
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
@@ -76,7 +76,7 @@
#location ~ /\.ht {
# deny all;
#}
- }
+ #}
# another virtual host using mix of IP-, name-, and port-based configuration
@@ -114,4 +114,5 @@
# }
#}

13
nginx-fastcgi-php.conf Normal file
View File

@ -0,0 +1,13 @@
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;

View File

@ -0,0 +1,14 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-openmamba.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
#location ~ .php$ {
# include snippets/fastcgi-php.conf;
# fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
#}
}

View File

@ -1,6 +1,6 @@
Name: nginx
Version: 1.21.1
Release: 2mamba
Release: 3mamba
Summary: High Performance Load Balancer, Web Server and Reverse Proxy
Group: System/Servers
Vendor: openmamba
@ -9,6 +9,8 @@ Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://nginx.org/
Source: https://github.com/nginx/nginx.git/release-%{version}/nginx-%{version}.tar.bz2
Source1: nginx.service
Source2: nginx-fastcgi-php.conf
Source3: nginx-sites-available-default
Patch0: nginx-1.21.1-conf-sites-enabled.patch
License: BSD
## AUTOBUILDREQ-BEGIN
@ -34,7 +36,7 @@ High Performance Load Balancer, Web Server and Reverse Proxy.
%prep
%setup -q
%patch0 -p1
#%patch0 -p1
%build
auto/configure \
@ -82,8 +84,14 @@ auto/configure \
%makeinstall
install -D -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/nginx.service
install -D -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/nginx/snippets/fastcgi-php.conf
install -D -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/nginx/sites-available/default
install -d -m0755 %{buildroot}%{_sysconfdir}/nginx/sites-{available,enabled}
install -d -m0755 %{buildroot}%{_localstatedir}/www/html
cp %{buildroot}%{_localstatedir}/www/nginx/html/index.html \
%{buildroot}%{_localstatedir}/www/html/index.nginx-openmamba.html
rm -f %{buildroot}%{_sysconfdir}/nginx/*.default
find %{buildroot} -type f -name perllocal.pod -exec rm -f {} ';'
@ -92,6 +100,7 @@ find %{buildroot} -type f -name perllocal.pod -exec rm -f {} ';'
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post
[ $1 -eq 1 ] && ln -s ../sites-available/default %{_sysconfdir}/nginx/sites-enabled/default
%systemd_post nginx
:
@ -115,7 +124,10 @@ find %{buildroot} -type f -name perllocal.pod -exec rm -f {} ';'
%{_sysconfdir}/nginx/koi-utf
%{_sysconfdir}/nginx/koi-win
%{_sysconfdir}/nginx/win-utf
%dir %{_sysconfdir}/nginx/snippets
%{_sysconfdir}/nginx/snippets/fastcgi-php.conf
%dir %{_sysconfdir}/nginx/sites-available
%config(noreplace) %{_sysconfdir}/nginx/sites-available/default
%dir %{_sysconfdir}/nginx/sites-enabled
%{_sbindir}/nginx
%{_unitdir}/nginx.service
@ -131,10 +143,14 @@ find %{buildroot} -type f -name perllocal.pod -exec rm -f {} ';'
%dir %{_localstatedir}/www/nginx
%dir %{_localstatedir}/www/nginx/html
%{_localstatedir}/www/nginx/html/*.html
%{_localstatedir}/www/html/index.nginx-openmamba.html
%dir %{_localstatedir}/log/nginx
%{_mandir}/man3/nginx.3pm*
%changelog
* Mon Aug 30 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 1.21.1-3mamba
- provide snippets/fastcgi-php.conf and move default site from nginx.conf to sites-available/default
* Sun Aug 29 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 1.21.1-2mamba
- configure with sites-enabled and site-available layout; remove .default configuration files