diff --git a/files/Customize-welcome-page.patch b/files/Customize-welcome-page.patch new file mode 100644 --- /dev/null +++ b/files/Customize-welcome-page.patch @@ -0,0 +1,36 @@ +From a3c9aac58d744e233b6264eafab81704479ea29a Mon Sep 17 00:00:00 2001 +From: Fabio Forni +Date: Sat, 4 Apr 2020 14:46:36 +0200 +Subject: [PATCH] Customize welcome page + +--- + html/index.html | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/html/index.html b/html/index.html +index 2ca3b95..720c459 100644 +--- a/html/index.html ++++ b/html/index.html +@@ -12,14 +12,13 @@ + + +

Welcome to nginx!

+-

If you see this page, the nginx web server is successfully installed and +-working. Further configuration is required.

++

If you see this welcome page, the nginx web server is successfully installed and ++working. You may now want to further configure nginx for Solus following the Help Center article.
++This welcome won't be displayed anymore as soon as you configure a new website.

+ +-

For online documentation and support please refer to ++

For online documentation and support about nginx specifically, please refer to + nginx.org.
+-Commercial support is available at +-nginx.com.

+ +-

Thank you for using nginx.

++

Thank you for using nginx for Solus.

+ + +-- +2.26.0 + 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 +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.18.0 +release : 35 source : - - http://nginx.org/download/nginx-1.17.8.tar.gz : 97d23ecf6d5150b30e284b40e8a6f7e3bb5be6b601e373a4d013768d5a25965b + - https://nginx.org/download/nginx-1.18.0.tar.gz : 4c373e7ab5bf91d34a4f11a0c9496561061ba5eee6020db272a17a7228d35f99 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,16 @@ - 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 + %patch -p1 < $pkgfiles/Customize-welcome-page.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,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 @@ nginx - Joshua Strobl - joshua@stroblindustries.com + Fabio Forni + livingsilver94.solus@redaril.me BSD-2-Clause programming - nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server. + Multi-purpose TCP server, mainly a proxy or HTTP server nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server. https://getsol.us/sources/README.Solus nginx - nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server. + Multi-purpose TCP server, mainly a proxy or HTTP server nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server. programming - /etc/nginx/fastcgi.conf - /etc/nginx/fastcgi_params - /etc/nginx/koi-utf - /etc/nginx/koi-win - /etc/nginx/mime.types - /etc/nginx/nginx.conf - /etc/nginx/scgi_params - /etc/nginx/uwsgi_params - /etc/nginx/win-utf /usr/lib64/systemd/system/nginx.service /usr/lib64/sysusers.d/nginx.conf /usr/lib64/tmpfiles.d/nginx.conf /usr/sbin/nginx - /usr/share/nginx/fastcgi.conf.default - /usr/share/nginx/fastcgi_params.default - /usr/share/nginx/html/50x.html - /usr/share/nginx/html/index.html - /usr/share/nginx/mime.types.default - /usr/share/nginx/nginx.conf.default - /usr/share/nginx/scgi_params.default - /usr/share/nginx/uwsgi_params.default + /usr/share/defaults/nginx/fastcgi.conf + /usr/share/defaults/nginx/fastcgi.conf.default + /usr/share/defaults/nginx/fastcgi_params + /usr/share/defaults/nginx/fastcgi_params.default + /usr/share/defaults/nginx/koi-utf + /usr/share/defaults/nginx/koi-win + /usr/share/defaults/nginx/mime.types + /usr/share/defaults/nginx/mime.types.default + /usr/share/defaults/nginx/nginx.conf + /usr/share/defaults/nginx/nginx.conf.default + /usr/share/defaults/nginx/scgi_params + /usr/share/defaults/nginx/scgi_params.default + /usr/share/defaults/nginx/uwsgi_params + /usr/share/defaults/nginx/uwsgi_params.default + /usr/share/defaults/nginx/win-utf + /usr/share/nginx/welcome.conf + /usr/share/nginx/welcome/50x.html + /usr/share/nginx/welcome/index.html /usr/share/vim/vimfiles/ftdetect/nginx.vim /usr/share/vim/vimfiles/ftplugin/nginx.vim /usr/share/vim/vimfiles/indent/nginx.vim @@ -47,12 +48,12 @@ - - 2020-02-06 - 1.17.8 + + 2020-04-22 + 1.18.0 Packaging update - Joshua Strobl - joshua@stroblindustries.com + Fabio Forni + livingsilver94.solus@redaril.me \ No newline at end of file