Page Menu
Home
Solus
Search
Configure Global Search
Log In
Files
F10848912
D8597.id20571.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
14 KB
Referenced Files
None
Subscribers
None
D8597.id20571.diff
View Options
diff --git a/files/Load-welcome-website-if-no-other-sites-are-available.patch b/files/Load-welcome-website-if-no-other-sites-are-available.patch
new file mode 100644
--- /dev/null
+++ b/files/Load-welcome-website-if-no-other-sites-are-available.patch
@@ -0,0 +1,112 @@
+From b94e4d529760f0a35e65bd0baac5f8df8ed39498 Mon Sep 17 00:00:00 2001
+From: Fabio Forni <livingsilver94.solus@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 | 82 ++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 82 insertions(+)
+
+diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
+index 6d1629e..8bde86c 100644
+--- a/src/core/ngx_conf_file.c
++++ b/src/core/ngx_conf_file.c
+@@ -153,6 +153,31 @@ ngx_conf_add_dump(ngx_conf_t *cf, ngx_str_t *filename)
+ return NGX_OK;
+ }
+
++int is_directory_empty(const char* path) {
++ DIR* dir;
++ if (!(dir = opendir(path))) {
++ /* Consider a non-existent directory as empty. */
++ if (errno == ENOENT) {
++ return 1;
++ }
++ return -1;
++ }
++ static const int N_EMPTY_ENT = 2;
++ int prev_errno = errno;
++ int count = 0;
++ while (readdir(dir)) {
++ if (count++ > N_EMPTY_ENT) break;
++ }
++ closedir(dir);
++ if (prev_errno != errno) {
++ return -1;
++ }
++ return count == N_EMPTY_ENT;
++}
++
++int success(int ret) {
++ return ret >= 0;
++}
+
+ char *
+ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
+@@ -174,6 +199,63 @@ 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) {
++ FILE* orig_stream = fopen(DEF_CONF_PATH, "r");
++ FILE* temp_stream = fopen(TMP_CONF_PATH, "w");
++ int ok;
++ char* line_buf;
++ size_t char_read = 0;
++ for (;;) {
++ ok = getline(&line_buf, &char_read, orig_stream);
++ if (!success(ok)) {
++ break;
++ }
++ ok = fputs(line_buf, temp_stream);
++ if (!success(ok)) {
++ break;
++ }
++ if (strncmp(line_buf, "http {", 6) == 0) {
++ break;
++ }
++ }
++ free(line_buf);
++ if (!success(ok)) {
++ goto closetemp;
++ }
++ ok = fputs("include /usr/share/nginx/welcome.conf;\n", temp_stream);
++ if (!success(ok)){
++ 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);
++ int 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 (!success(copied)) {
++ ok = -1;
++ goto closetemp;
++ }
++ remaining -= copied;
++ } while (remaining > 0 && copied > 0);
++closetemp:
++ fclose(temp_stream);
++ fclose(orig_stream);
++ if (success(ok)) {
++ 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,4 +1,3 @@
-
#user nobody;
worker_processes 1;
@@ -33,27 +32,27 @@
#gzip on;
server {
- listen 80;
- server_name localhost;
+ #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;
- }
+ #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;
- }
+ #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
#
@@ -61,8 +60,7 @@
# proxy_pass http://127.0.0.1;
#}
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
+ # 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;
@@ -78,7 +76,6 @@
#}
}
-
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
@@ -114,4 +111,6 @@
# }
#}
+ 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 :
@@ -14,14 +14,15 @@
- pkgconfig(openssl)
- libpth-devel
setup : |
- loggingDir=/var/log/nginx/
- ./configure --prefix=/usr \
- --build=x86_64-solus-linux \
- --conf-path=/etc/nginx/nginx.conf \
+ %patch -p1 < $pkgfiles/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 +33,24 @@
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
+
# 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,45 @@
<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="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 +48,12 @@
</Files>
</Package>
<History>
- <Update release="34">
- <Date>2020-02-06</Date>
- <Version>1.17.8</Version>
+ <Update release="35">
+ <Date>2020-04-01</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
Details
Attached
Mime Type
text/plain
Expires
Jun 12 2023, 5:10 PM (8 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5855695
Default Alt Text
D8597.id20571.diff (14 KB)
Attached To
Mode
D8597: Update nginx to 1.18.0
Attached
Detach File
Event Timeline
Log In to Comment