Page MenuHomeSolus

D8597.id20539.diff
No OneTemporary

D8597.id20539.diff

diff --git a/files/0001-Load-welcome-website-if-no-other-sites-are-available.patch b/files/0001-Load-welcome-website-if-no-other-sites-are-available.patch
new file mode 100644
--- /dev/null
+++ b/files/0001-Load-welcome-website-if-no-other-sites-are-available.patch
@@ -0,0 +1,110 @@
+From a44068836ad3febc0762dea121029cf5883a0dd0 Mon Sep 17 00:00:00 2001
+From: Fabio Forni <fabio@redaril.me>
+Date: Sun, 29 Mar 2020 14:48:00 +0200
+Subject: [PATCH] Load welcome website if no other sites are available
+
+---
+ src/core/ngx_conf_file.c | 80 ++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 80 insertions(+)
+
+diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
+index 6d1629e..667cd6f 100644
+--- a/src/core/ngx_conf_file.c
++++ b/src/core/ngx_conf_file.c
+@@ -153,6 +153,30 @@ ngx_conf_add_dump(ngx_conf_t *cf, ngx_str_t *filename)
+ return NGX_OK;
+ }
+
++int is_directory_empty(const char* path) {
++ DIR* dir = opendir(path);
++ if (dir == NULL) {
++ return -1;
++ }
++ static const int n_mandatory_ent = 2;
++ struct dirent* ent;
++ int children_count = 0;
++ int prev_errno = errno;
++ while ((ent = readdir(dir))) {
++ if (children_count++ > n_mandatory_ent) {
++ break;
++ }
++ }
++ closedir(dir);
++ if (prev_errno != errno) {
++ return -1;
++ }
++ return children_count <= n_mandatory_ent;
++}
++
++int success(int ret) {
++ return ret >= 0;
++}
+
+ char *
+ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
+@@ -174,6 +198,62 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
+ #endif
+
+ if (filename) {
++ static const char* SITES_AVAILABLE_PATH = "/etc/nginx/sites-available";
++ static const char* DEF_CONF_PATH = "/usr/share/defaults/nginx/nginx.conf";
++ static const char* TMP_CONF_PATH = "/tmp/nginx.conf";
++ if (ngx_strcmp(filename->data, DEF_CONF_PATH) == 0 && is_directory_empty(SITES_AVAILABLE_PATH) > 0) {
++ int ret;
++ FILE* orig_stream = fopen(DEF_CONF_PATH, "r");
++ FILE* temp_stream = fopen(TMP_CONF_PATH, "w");
++ char* line_buf;
++ size_t char_read = 0;
++ for (;;) {
++ ret = getline(&line_buf, &char_read, orig_stream);
++ if (!success(ret)) {
++ break;
++ }
++ ret = fputs(line_buf, temp_stream);
++ if (!success(ret)) {
++ break;
++ }
++ if (strncmp(line_buf, "http {", 6) == 0) {
++ break;
++ }
++ }
++ free(line_buf);
++ if (!success(ret)) {
++ goto closetemp;
++ }
++ ret = fputs("include /usr/share/nginx/welcome.conf;\n", temp_stream);
++ if (!success(ret)){
++ goto closetemp;
++ }
++ fflush(temp_stream);
++
++ /* Read original conf file length and offset. */
++ int orig_fd = fileno(orig_stream);
++ int orig_off = ftell(orig_stream);
++ int orig_size = lseek(orig_fd, 0, SEEK_END);
++ lseek(orig_fd, orig_off, SEEK_SET);
++ off_t remaining = orig_size - orig_off;
++
++ /* Copy the rest of the original file untouched. */
++ int temp_fd = fileno(temp_stream);
++ int copied;
++ do {
++ copied = copy_file_range(orig_fd, NULL, temp_fd, NULL, remaining, 0);
++ if (copied == -1) {
++ goto closetemp;
++ }
++ remaining -= copied;
++ } while (remaining > 0 && copied > 0);
++closetemp:
++ fclose(temp_stream);
++ fclose(orig_stream);
++ if (success(ret)) {
++ filename->data = (unsigned char*) TMP_CONF_PATH;
++ }
++ }
+
+ /* open configuration file */
+
+--
+2.26.0
+
diff --git a/files/nginx.conf b/files/nginx.conf
--- a/files/nginx.conf
+++ b/files/nginx.conf
@@ -1,117 +1,37 @@
+# This conf file is inspired to Debian. Thank you!
-#user nobody;
+# Solus is not a server distro. 1 process should suffice.
worker_processes 1;
-#error_log logs/error.log;
-#error_log logs/error.log notice;
-#error_log logs/error.log info;
-
-#pid logs/nginx.pid;
-
-
events {
- worker_connections 1024;
+ worker_connections 1024;
}
-
http {
- include mime.types;
- default_type application/octet-stream;
-
- #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- # '$status $body_bytes_sent "$http_referer" '
- # '"$http_user_agent" "$http_x_forwarded_for"';
-
- #access_log logs/access.log main;
-
- sendfile on;
- #tcp_nopush on;
-
- #keepalive_timeout 0;
- keepalive_timeout 65;
-
- #gzip on;
-
- server {
- listen 80;
- server_name localhost;
-
- #charset koi8-r;
-
- #access_log logs/host.access.log main;
-
-
- root /usr/share/nginx/html;
- location / {
- 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;
- }
-
- # proxy the PHP scripts to Apache listening on 127.0.0.1:80
- #
- #location ~ \.php$ {
- # proxy_pass http://127.0.0.1;
- #}
-
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- location ~ \.php$ {
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
-
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- #
- #location ~ /\.ht {
- # deny all;
- #}
- }
-
-
- # another virtual host using mix of IP-, name-, and port-based configuration
- #
- #server {
- # listen 8000;
- # listen somename:8080;
- # server_name somename alias another.alias;
-
- # location / {
- # root html;
- # index index.html index.htm;
- # }
- #}
-
-
- # HTTPS server
- #
- #server {
- # listen 443 ssl;
- # server_name localhost;
-
- # ssl_certificate cert.pem;
- # ssl_certificate_key cert.key;
-
- # ssl_session_cache shared:SSL:1m;
- # ssl_session_timeout 5m;
-
- # ssl_ciphers HIGH:!aNULL:!MD5;
- # ssl_prefer_server_ciphers on;
-
- # location / {
- # root html;
- # index index.html index.htm;
- # }
- #}
-
+ sendfile on;
+ tcp_nopush on;
+ tcp_nodelay on;
+ keepalive_timeout 65;
+ types_hash_max_size 2048;
+
+ include mime.types;
+ default_type application/octet-stream;
+
+ ssl_protocols TLSv1.2 TLSv1.3;
+ ssl_prefer_server_ciphers on;
+
+ gzip on;
+
+ # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+ server {
+ location ~ \.php$ {
+ fastcgi_pass 127.0.0.1:9000;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ include fastcgi_params;
+ }
+ }
+
+ include /etc/nginx/conf.d/*.conf;
+ include /etc/nginx/sites-enabled/*;
}
diff --git a/files/welcome.conf b/files/welcome.conf
new file mode 100644
--- /dev/null
+++ b/files/welcome.conf
@@ -0,0 +1,10 @@
+server {
+ listen 80;
+ server_name localhost;
+ root /usr/share/nginx/welcome;
+ location / {
+ }
+ error_page 500 502 503 504 /50x.html;
+ location = /50x.html {
+ }
+}
diff --git a/package.yml b/package.yml
--- a/package.yml
+++ b/package.yml
@@ -1,11 +1,11 @@
name : nginx
-version : 1.17.8
-release : 34
+version : 1.17.9
+release : 35
source :
- - http://nginx.org/download/nginx-1.17.8.tar.gz : 97d23ecf6d5150b30e284b40e8a6f7e3bb5be6b601e373a4d013768d5a25965b
+ - https://nginx.org/download/nginx-1.17.9.tar.gz : 7dd65d405c753c41b7fdab9415cfb4bdbaf093ec6d9f7432072d52cb7bcbb689
license : BSD-2-Clause
component : programming
-summary : nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server.
+summary : Multi-purpose TCP server, mainly a proxy or HTTP server
description: |
nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server.
builddeps :
@@ -13,15 +13,17 @@
- pkgconfig(libxslt)
- pkgconfig(openssl)
- libpth-devel
+strip : no
setup : |
- loggingDir=/var/log/nginx/
- ./configure --prefix=/usr \
- --build=x86_64-solus-linux \
- --conf-path=/etc/nginx/nginx.conf \
+ %patch -p1 < $pkgfiles/0001-Load-welcome-website-if-no-other-sites-are-available.patch
+ loggingDir=/var/log/nginx
+ ./configure --build=x86_64-solus-linux \
+ --conf-path=/usr/share/defaults/nginx/nginx.conf \
--error-log-path=$loggingDir/error.log \
--group=nginx \
--http-log-path=$loggingDir/access.log \
--pid-path=/run/nginx.pid \
+ --prefix=/usr \
--user=nginx \
--with-file-aio \
--with-http_ssl_module \
@@ -32,21 +34,27 @@
build : |
%make
install : |
- vimDir=$installdir/usr/share/vim/vimfiles/
- install -dm00644 $installdir/etc/nginx/
- install -dm00644 $installdir/usr/share/nginx/
- install -dm00644 $vimDir
%make_install
- # Install nginx systemd stuff
- install -Dm00644 $pkgfiles/nginx.service $installdir/%libdir%/systemd/system/nginx.service
+
+ # VIM files
+ install -dm00755 $installdir/usr/share/vim/vimfiles
+ cp -a $workdir/contrib/vim/* $installdir/usr/share/vim/vimfiles
+
+ # Welcome website (appears at first run)
+ install -Dm00644 $pkgfiles/welcome.conf -t $installdir/usr/share/nginx
+ mv $installdir/usr/html $installdir/usr/share/nginx/welcome
+
+ # Systemd stuff
+ install -Dm00644 $pkgfiles/nginx.service -t $installdir/%libdir%/systemd/system
install -Dm00644 $pkgfiles/nginx.sysusers $installdir/%libdir%/sysusers.d/nginx.conf
install -Dm00644 $pkgfiles/nginx.tmpfiles $installdir/%libdir%/tmpfiles.d/nginx.conf
- # Move HTML and vim stuff
- mv $installdir/usr/html $installdir/usr/share/nginx/
- mv $workdir/contrib/vim/* $vimDir/
- # Move defaults into vendor dir for safety
- mv $installdir/etc/nginx/*.default $installdir/usr/share/nginx/
- # Move our configuration
- install -Dm00644 $pkgfiles/nginx.conf $installdir/etc/nginx/nginx.conf
+
+ # Make nginx stateless
+ rm -rf $installdir/usr/share/defaults/*.default
+ install -Dm00644 $pkgfiles/nginx.conf -t $installdir/usr/share/defaults/nginx
+
+ install -dm00755 $installdir/etc/nginx/sites-available
+ install -dm00755 $installdir/etc/nginx/sites-enabled
+
# Cleanup
rm -rf $installdir/{run,var}
diff --git a/pspec_x86_64.xml b/pspec_x86_64.xml
--- a/pspec_x86_64.xml
+++ b/pspec_x86_64.xml
@@ -2,44 +2,47 @@
<Source>
<Name>nginx</Name>
<Packager>
- <Name>Joshua Strobl</Name>
- <Email>joshua@stroblindustries.com</Email>
+ <Name>Fabio Forni</Name>
+ <Email>livingsilver94.solus@redaril.me</Email>
</Packager>
<License>BSD-2-Clause</License>
<PartOf>programming</PartOf>
- <Summary xml:lang="en">nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server.</Summary>
+ <Summary xml:lang="en">Multi-purpose TCP server, mainly a proxy or HTTP server</Summary>
<Description xml:lang="en">nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server.
</Description>
<Archive type="binary" sha1sum="79eb0752a961b8e0d15c77d298c97498fbc89c5a">https://getsol.us/sources/README.Solus</Archive>
</Source>
<Package>
<Name>nginx</Name>
- <Summary xml:lang="en">nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server.</Summary>
+ <Summary xml:lang="en">Multi-purpose TCP server, mainly a proxy or HTTP server</Summary>
<Description xml:lang="en">nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server.
</Description>
<PartOf>programming</PartOf>
<Files>
- <Path fileType="config">/etc/nginx/fastcgi.conf</Path>
- <Path fileType="config">/etc/nginx/fastcgi_params</Path>
- <Path fileType="config">/etc/nginx/koi-utf</Path>
- <Path fileType="config">/etc/nginx/koi-win</Path>
- <Path fileType="config">/etc/nginx/mime.types</Path>
- <Path fileType="config">/etc/nginx/nginx.conf</Path>
- <Path fileType="config">/etc/nginx/scgi_params</Path>
- <Path fileType="config">/etc/nginx/uwsgi_params</Path>
- <Path fileType="config">/etc/nginx/win-utf</Path>
+ <Path fileType="config">/etc/nginx/sites-available</Path>
+ <Path fileType="config">/etc/nginx/sites-enabled</Path>
<Path fileType="library">/usr/lib64/systemd/system/nginx.service</Path>
<Path fileType="library">/usr/lib64/sysusers.d/nginx.conf</Path>
<Path fileType="library">/usr/lib64/tmpfiles.d/nginx.conf</Path>
<Path fileType="executable">/usr/sbin/nginx</Path>
- <Path fileType="data">/usr/share/nginx/fastcgi.conf.default</Path>
- <Path fileType="data">/usr/share/nginx/fastcgi_params.default</Path>
- <Path fileType="data">/usr/share/nginx/html/50x.html</Path>
- <Path fileType="data">/usr/share/nginx/html/index.html</Path>
- <Path fileType="data">/usr/share/nginx/mime.types.default</Path>
- <Path fileType="data">/usr/share/nginx/nginx.conf.default</Path>
- <Path fileType="data">/usr/share/nginx/scgi_params.default</Path>
- <Path fileType="data">/usr/share/nginx/uwsgi_params.default</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/fastcgi.conf</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/fastcgi.conf.default</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/fastcgi_params</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/fastcgi_params.default</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/koi-utf</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/koi-win</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/mime.types</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/mime.types.default</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/nginx.conf</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/nginx.conf.default</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/scgi_params</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/scgi_params.default</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/uwsgi_params</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/uwsgi_params.default</Path>
+ <Path fileType="data">/usr/share/defaults/nginx/win-utf</Path>
+ <Path fileType="data">/usr/share/nginx/welcome.conf</Path>
+ <Path fileType="data">/usr/share/nginx/welcome/50x.html</Path>
+ <Path fileType="data">/usr/share/nginx/welcome/index.html</Path>
<Path fileType="data">/usr/share/vim/vimfiles/ftdetect/nginx.vim</Path>
<Path fileType="data">/usr/share/vim/vimfiles/ftplugin/nginx.vim</Path>
<Path fileType="data">/usr/share/vim/vimfiles/indent/nginx.vim</Path>
@@ -47,12 +50,12 @@
</Files>
</Package>
<History>
- <Update release="34">
- <Date>2020-02-06</Date>
- <Version>1.17.8</Version>
+ <Update release="35">
+ <Date>2020-03-31</Date>
+ <Version>1.17.9</Version>
<Comment>Packaging update</Comment>
- <Name>Joshua Strobl</Name>
- <Email>joshua@stroblindustries.com</Email>
+ <Name>Fabio Forni</Name>
+ <Email>livingsilver94.solus@redaril.me</Email>
</Update>
</History>
</PISI>
\ No newline at end of file

File Metadata

Mime Type
text/plain
Expires
Jun 12 2023, 2:46 PM (8 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5855608
Default Alt Text
D8597.id20539.diff (16 KB)

Event Timeline