Giter Club home page Giter Club logo

nginx-more's Introduction

Nginx-more

Release Build Quality Gate Status Installs Downloads

Synopsis

Nginx-more is a build of Nginx with additional modules such as HTTP2, PageSpeed, Brotli, More Headers, Cache Purge, VTS, GeoIP2, Echo. It's compiled using recent GCC version and latest OpenSSL sources. It also includes some built-in configurations such as WordPress and Laravel php-fpm setup. More information about this package can be found here however this post is be a bit outdated at this time. Nginx-more is supported since 2014 and used on a thousand of servers.

Easy installation for RHEL / CentOS / AlmaLinux / Rocky Linux

There's packages available for Enterprise Linux 6, 7, 8 and 9. The easiest way to install nginx-more is by using Aeris yum repository:

EL6 > yum install -y https://repo.aerisnetwork.com/pub/aeris-release-6.rpm
EL7 > yum install -y https://repo.aerisnetwork.com/pub/aeris-release-7.rpm
EL8 > dnf install -y https://repo.aerisnetwork.com/pub/aeris-release-8.rpm
EL9 > dnf install -y https://repo.aerisnetwork.com/pub/aeris-release-9.rpm

Once the repository is configured, you can proceed with installing nginx-more:

> yum install nginx-more

All configurations will be installed in default directory which is /etc/nginx/. The package already includes a bunch of PHP-FPM configurations in conf.d/custom/ for WordPress, Laravel, Drupal, OpenCart, PrestaShop and Sendy, so you can get started in few seconds with your website hosting.

Clean vhost example for WordPress:

server {
    listen 80;
    listen 443 ssl http2;
    server_name example.com;
    root /home/www/example.com/public_html;
    access_log /var/log/nginx/example.com-access_log main;
    error_log /var/log/nginx/example.com-error_log warn;

    if ($bad_bot) { return 444; }

    include conf.d/custom/ssl.global.conf;
    include conf.d/custom/restrictions.conf;
    include conf.d/custom/pagespeed.conf;
    include conf.d/custom/fpm-wordpress.conf;
}

All nginx-more builds are kept in the repository. If you upgrade to a newest version and it has any issues that you don't have time to troubleshoot by looking at the nginx error_log, you can downgrade to an older version with yum:

> yum downgrade nginx-more

Note that you cannot install nginx-more if nginx package is already installed on your system because both packages provide nginx binary and configurations. You need to choose between nginx-more OR nginx from CentOS / EPEL / Nginx repository. Nginx-more is compiled using a more recent GCC version than the others and it provides lots of ready-to-go WordPress / Laravel configurations. If nginx is already installed, it's possible to swap from nginx to nginx-more with a simple yum command, although be careful with your inplace configurations. A new install is recommended.

> yum swap nginx nginx-more

Full output of nginx configure:

> nginx -V
nginx version: nginx/1.24.0
custom build maintained on github.com/karljohns0n/nginx-more
built by gcc 11.4.1 20230605 (Red Hat 11.4.1-2) (GCC) 
built with OpenSSL 3.2.1 30 Jan 2024
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/cache/client_body --http-proxy-temp-path=/var/lib/nginx/cache/proxy --http-fastcgi-temp-path=/var/lib/nginx/cache/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/cache/uwsgi --http-scgi-temp-path=/var/lib/nginx/cache/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --user=nginx --group=nginx --with-compat --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-threads --with-stream --with-stream_ssl_module --with-stream_realip_module --with-http_slice_module --with-stream_ssl_preread_module --with-debug --with-cc-opt='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DTCP_FASTOPEN=23' --with-openssl=modules/openssl-3.2.1 --with-openssl-opt=enable-ktls --with-http_v2_hpack_enc --add-dynamic-module=modules/ngx_modsecurity-1.0.3 --add-module=modules/ngx_headers_more-0.37 --add-module=modules/ngx_cache_purge-2.3 --add-module=modules/ngx_brotli-1.0.0rc-2-g6e97 --add-module=modules/ngx_module_vts-0.2.2 --add-module=modules/ngx_http_geoip2_module-3.4 --add-module=modules/ngx_echo-0.63

Packages

Modules

Patches

SELinux

Third-party modules such as PageSpeed will cause trouble while SELinux enforced. To get nginx-more works with SELinux, you need at least to turn on httpd_execmem policy:

> yum -y install policycoreutils && setsebool -P httpd_execmem 1
> systemctl start nginx

It's possible to temporarily disable SELinux for Nginx to get started quickly:

> semanage permissive -a httpd_t

Here's two nice external blogs to help you troubleshoot SELinux with Nginx:

Ansible playbook

A simple Ansible role is available to install nginx-more and keep it updated.

Example of playbook:

- hosts: servers
    roles:
      - { role: karljohns0n.nginx-more }

Package dependencies

As of writing, only one package outside EL default repositories is required to build nginx-more RPM, which is libmaxminddb-devel for module GeoIP2. It's available in EPEL however a newer version is available in Aeris repository so it's recommended to add Aeris repository in your mock configuration. We try to avoid packages that aren't available in EL but if it's the case we will build and include them in Aeris repository therefore no other third-party repository is required to build nginx-more.

nginx-more's People

Contributors

bugfest avatar karljohns0n avatar vlasky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nginx-more's Issues

Consider adding those 2 patches

Great job on this build @karljohns0n!
Please consider adding the 2 patches below:

  1. Cloudflare's dynamic TLS records:
    https://github.com/cloudflare/sslconfig/blob/master/patches/nginx__dynamic_tls_records.patch
    (more on https://blog.cloudflare.com/optimizing-tls-over-tcp-to-reduce-latency/)

and

  1. Cloudflare's patch for HPACK Huffman encoding for response headers:
    http://hg.nginx.org/nginx/rev/ba3c2ca21aa5
    (more on https://blog.cloudflare.com/hpack-the-silent-killer-feature-of-http-2/)

Thank you.

How compile an rpm myself?

Hi,

We would like to use your nginx-more as a base for adding additional modules as well. How would we be able todo that? Could you explain a bit how you build your packages? Maybe i can help in building a script that would run for example in a docker container and results in building an rpm. Glad to help out.

Start error after installing.

Hi, I've already had nginx installed in my server.
After remove nginx, delete all log, conf ...
Then install nginx more.
I'm having this error when starting.

   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2019-10-13 09:30:17 UTC; 7s ago
     Docs: http://nginx.org/en/docs/
  Process: 32136 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=127)

Oct 13 09:30:17 stg-playerduo systemd[1]: Starting nginx - high performance web server...
Oct 13 09:30:17 stg-playerduo nginx[32136]: /usr/sbin/nginx: error while loading shared libraries: cannot create cache for search path: Cannot allocate memory
Oct 13 09:30:17 stg-playerduo systemd[1]: nginx.service: control process exited, code=exited status=127
Oct 13 09:30:17 stg-playerduo systemd[1]: Failed to start nginx - high performance web server.
Oct 13 09:30:17 stg-playerduo systemd[1]: Unit nginx.service entered failed state.
Oct 13 09:30:17 stg-playerduo systemd[1]: nginx.service failed.```
Please help! Thanks
By the way, do we have any way to upgrade from nginx to nginx more.

CentOS Stream

Thanks for your great work!

How will this project work with CentOS Stream?

arm support

Hi Karl

First of all, I want to thank you by this awesome nginx you offer to the community.
I just want to ask you if you have any plans to support new arm architectures, as many distros are moving to support arm, like Rocky Linux.

Best regards!

Support for Debian

Dear friend,

Is there any plan to support Debian in the future. I am a little bit scared now about corporate owned Linux distributions since Redhat decided to put a pay wall in front of their source code. Canonical exhibits lesser but similar behaviors so I am considering moving away from Ubuntu too in the future.

Debian is a really good candidate for critical production servers. It should be a no brainer to go that route from now on.

Cheers ๐Ÿบ

modsec-shared-collections

I note owasp-modsecurity/ModSecurity-nginx#174

Thanks for your work on this repo, it is a real timesaver!

I didn't understand the closing status of your issue. It's quite a big problem to have these files all over the filesystem. I did want to use modsecurity so not loading the module isn't a good solution.

I didn't quite understand how this might be normal. I realise it's somewhat outside your control but I'm asking if you found a solution.

SSL handshake failed

Hi Karl,
I was using your testing version of nginx-more-1.22.0-4.el8.x86_64 and others, I was seeing CloudFlare saying SSL handshake failed.

I happened lots of time on my AlmaLinux 8.

I also tried changing to all Cloudflare supported chipers for TLS 1.2 and 1.3 that I am using. But nothing worked at all!

I am in doubt if that is due to openssl 1.1.1 used on my server where nginx-more 1.22 is build using openssl 3.

I am not sure about openssl issues but error was continuing so I had to move back to the stable version.

Please advice me the possible way to resolve this!

Thanks!

My issue when installed on CentOS 7

This is my story...

I have 2 VPS ready with the latest updates Centos 7.
sudo yum -y upgrade
No packages marked for update

On Server 1

  1. I added some repos, such as: epel, remi, etc.
  2. For nginx, I added codeit repo.
  3. Upgraded Centos packages, and there are several packages updated.
  4. I installed Nginx, configure nginx for testing.
    I create a configuration file nginx in /etc/nginx/conf.d/testing.conf.
    Test the config file:
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    and start nginx service, open a browser, and the website is running.
    Then I plan to use aeris repo for nginx, replacing nginx codeit with nginx-more.
  5. Remove existing nginx. sudo yum -y remove nginx.
  6. Added aeris repo, then sudo yum -y upgrade and install nginx-more: sudo yum -y install nginx-more.
  7. I modify the config file nginx: moving my config file from /etc/nginx/conf.d/testing.conf to /etc/nginx/conf.d/vhosts/testing.conf.
  8. Test the config file:
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    restart nginx service, try it in browser and the website is running.

On Server 2
"This is where the problem appears".
I skipped some steps for this server, because I want to use aeris repo.

  1. I added some repos, such as: epel, remi, etc.
  2. Upgraded Centos packages, and there are several packages updated.
  3. Added aeris repo, then sudo yum -y upgrade and install nginx-more: sudo yum -y install nginx-more.
  4. I create a configuration file nginx in /etc/nginx/conf.d/vhosts/testing.conf.
  5. Test the config file:
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    but I can't start nginx service and even I tried restarting the server, but that didn't help.
    And there is no log information about the nginx service which is an error, I think.

"This is the error.log"
2020/12/17 11:07:07 [info] 11095#11095: [ngx_pagespeed 1.13.35.2-0] No threading detected. Own threads: 1 Rewrite, 1 Expensive Rewrite. 2020/12/17 11:07:07 [info] 11095#11095: pagespeed: rollback gzip, explicit configuration in /etc/nginx/nginx.conf:49 2020/12/17 11:32:34 [info] 11316#11316: [ngx_pagespeed 1.13.35.2-0] No threading detected. Own threads: 1 Rewrite, 1 Expensive Rewrite. 2020/12/17 11:32:34 [info] 11316#11316: pagespeed: rollback gzip, explicit configuration in /etc/nginx/nginx.conf:49 2020/12/17 11:32:36 [info] 11319#11319: [ngx_pagespeed 1.13.35.2-0] No threading detected. Own threads: 1 Rewrite, 1 Expensive Rewrite. 2020/12/17 11:32:36 [info] 11319#11319: pagespeed: rollback gzip, explicit configuration in /etc/nginx/nginx.conf:49 2020/12/17 11:32:43 [notice] 1050#1050: signal 15 (SIGTERM) received from 11330, exiting 2020/12/17 11:32:43 [notice] 1060#1060: exiting 2020/12/17 11:32:43 [notice] 1051#1051: exiting 2020/12/17 11:32:43 [notice] 1056#1056: exiting 2020/12/17 11:32:43 [notice] 1057#1057: exiting 2020/12/17 11:32:43 [notice] 1052#1052: exiting 2020/12/17 11:32:43 [notice] 1059#1059: exiting 2020/12/17 11:32:43 [notice] 1058#1058: exiting 2020/12/17 11:32:43 [notice] 1055#1055: exiting 2020/12/17 11:32:43 [notice] 1053#1053: exiting 2020/12/17 11:32:43 [notice] 1053#1053: exit 2020/12/17 11:32:43 [notice] 1058#1058: exit 2020/12/17 11:32:43 [notice] 1055#1055: exit 2020/12/17 11:32:43 [notice] 1052#1052: exit 2020/12/17 11:32:43 [notice] 1056#1056: exit 2020/12/17 11:32:43 [notice] 1059#1059: exit 2020/12/17 11:32:43 [notice] 1051#1051: exit 2020/12/17 11:32:43 [notice] 1057#1057: exit 2020/12/17 11:32:43 [notice] 1050#1050: signal 17 (SIGCHLD) received from 1055 2020/12/17 11:32:43 [notice] 1050#1050: worker process 1055 exited with code 0 2020/12/17 11:32:43 [notice] 1050#1050: signal 29 (SIGIO) received 2020/12/17 11:32:43 [notice] 1050#1050: signal 17 (SIGCHLD) received from 1060 2020/12/17 11:32:43 [notice] 1050#1050: cache manager process 1060 exited with code 0 2020/12/17 11:32:43 [notice] 1050#1050: signal 29 (SIGIO) received 2020/12/17 11:32:43 [notice] 1050#1050: signal 17 (SIGCHLD) received from 1058 2020/12/17 11:32:43 [notice] 1050#1050: worker process 1052 exited with code 0 2020/12/17 11:32:43 [notice] 1050#1050: worker process 1053 exited with code 0 2020/12/17 11:32:43 [notice] 1050#1050: worker process 1056 exited with code 0 2020/12/17 11:32:43 [notice] 1050#1050: worker process 1057 exited with code 0 2020/12/17 11:32:43 [notice] 1050#1050: worker process 1058 exited with code 0 2020/12/17 11:32:43 [notice] 1050#1050: worker process 1059 exited with code 0 2020/12/17 11:32:43 [notice] 1050#1050: signal 29 (SIGIO) received

So I executed the steps I skipped on Server 1.
I added codeit repo.
Upgraded Centos packages, and there are several packages updated.
Reinstall nginx-more, without changing nginx config file.
Then I start nginx service and now nginx service is running as well as the website.

Caching issues?

Hi Karl,

Apparently I am experiencing a caching issue after importing a shop (woocommerce).
The cart does not reflect what is added in it, it is showing "empty cart" for logged out users and working fine if logged in.
I spent the day on this and just can't figure it out.

I used cachtool to flush the cache but this is not having any effect on the issue.
php cachetool.phar opcache:reset --fcgi=/run/php-fpm/user1.sock

Questions:
Is there a way to prevent the cart from being cached?
What is the cache in place with nginx-more?

Thanks a lot

Reverse Proxying Apache - PageSpeed - Question

This isn't an issue as such but more a question.

I've been using Nginx-More for six months with PageSpeed disabled. Nginx is caching an Apache http server and has been working fine.

Last week I decided to enable PageSpeed to see if I could squeeze a bit more performance out of it and found that the opposite happened. My sites appeared to perform slower.

My question is, when Nginx is configured as a Reverse Proxy Cache and PageSpeed is enabled am I effectively Caching the Cache?

PageSpeed has it's own Caching parameters so I have assumed it is a cache.

I have disabled PageSpeed again and the performance has improved.

I don't care if PageSpeed is enabled but am curious if I was caching a cache which is pointless.

HTTP/3

Hello.
Will modul HTTP/3 be added?

Unable to build as public sources are not referenced in the spec file

Problem description

Local/forked repos fails to build as the nginx-more package source dependencies are not using public URLs but currently relying in snapshots hosted in a private host, controlled by secrets.CDNURL gh actions variable (

bash /tmp/"${{ env.PKG_NAME }}"/.github/workflows/fetch_sources.sh "${{ secrets.CDNURL }}"
)

This causes builds to fail as they cannot retrieve the sources. Example output when building nginx-more using act for rockylinux:8

$ act -v -j buildrpm
...
[nginx-more/Build el8 package]   ๐Ÿณ  docker run image=act-addnab-docker-run-action-v3-dockeraction:latest platform= entrypoint=[] cmd=[]
[nginx-more/Build el8 package] [DEBUG] Starting container: 444f91f829a5ff0e4d6c3fca191864197b3a75339d608cb7cd7bd4bf730aa679
[nginx-more/Build el8 package] [DEBUG] Started container: 444f91f829a5ff0e4d6c3fca191864197b3a75339d608cb7cd7bd4bf730aa679
| + cd tmp/nginx-more
| ++ awk '{print $2}'
| ++ grep Version: SPECS/nginx-more.spec
| + PKG_VERSION=1.22.1
| ++ awk '{print $2}'
| ++ grep Release: SPECS/nginx-more.spec
| ++ tr -d '%{?dist}'
| + PKG_RELEASE=3
| + mkdir -p /tmp/nginx-more/BUILD /tmp/nginx-more/RPMS /tmp/nginx-more/SPECS /tmp/nginx-more/SOURCES /tmp/nginx-more/SRPMS
| + bash /tmp/nginx-more/.github/workflows/fetch_sources.sh ''
| Getting https://nginx.org/download/nginx-1.22.1.tar.gz to /tmp/nginx-more/SOURCES/nginx-1.22.1.tar.gz
|   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
|                                  Dload  Upload   Total   Spent    Left  Speed
100 1048k  100 1048k    0     0  1517k      0 --:--:-- --:--:-- --:--:-- 1515k
| Getting https://www.openssl.org/source/openssl-3.0.8.tar.gz to /tmp/nginx-more/SOURCES/openssl-3.0.8.tar.gz
|   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
|                                  Dload  Upload   Total   Spent    Left  Speed
^R
100 14.4M  100 14.4M    0     0  6054k      0  0:00:02  0:00:02 --:--:-- 6054k
| Error downloading ngx_pagespeed-1.13.35.2-stable.tar.gz.
| Error downloading psol-1.13.35.2-stable.tar.gz.
| Error downloading ngx_headers_more-0.34.tar.gz.
| Error downloading ngx_cache_purge-2.3.tar.gz.
| Error downloading ngx_brotli-snap20220505.tar.gz.
| Error downloading ngx_module_vts-0.2.1.tar.gz.
| Error downloading ngx_http_geoip2_module-3.4.tar.gz.
| Error downloading ngx_echo-0.62.tar.gz.
| Error downloading ngx_modsecurity-1.0.3.tar.gz.
| + mock --isolation=simple -r aeris-8-x86_64 --spec=/tmp/nginx-more/SPECS/nginx-more.spec --sources=/tmp/nginx-more/SOURCES --resultdir=/tmp/nginx-more/SRPMS --buildsrpm --with=modsecurity --with=pagespeed
| INFO: mock.py version 3.5 starting (python version = 3.6.8, NVR = mock-3.5-1.el8)...
| Start(bootstrap): init plugins
...

Solution proposal

Fix the nginx-more.spec so that spectool can fetch the sources from public URLs: https://github.com/karljohns0n/nginx-more/blob/master/SPECS/nginx-more.spec#L80

This change can help the community to maintain this project by being able rebuild it locally

Consider Updating

Hi Karl,
NGINX 1.22 was released weeks before and libmodsecurity 3.0.7 was released 14 days ago. I see that lots of issues were fixed in the latest version.

Please consider updating them if you can manage time!

Besides, I had seen that you also mentioned you will releasing rpm repos for el9. As you know that AlmaLinux 9 and RHEL 9 are already released; So. is it possible for you to keep rpm repos for el9 also?

Thanks n you are awesome!!

Rocky Linux

Hi,

Any plan this great repo to support rocky linux?

Regards.

Attempted to install on Centos 7

yum install nginx-more

Resolving Dependencies
--> Running transaction check
---> Package nginx-more.x86_64 0:1.16.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size

Installing:
nginx-more x86_64 1.16.1-4.el7 aeris 6.0 M

Transaction Summary

Install 1 Package

Total size: 6.0 M
Installed size: 17 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test

Transaction check error:
file /etc/logrotate.d/nginx from install of nginx-more-1.16.1-4.el7.x86_64 conflicts with file from package nginx-1:1.17.10-1.el7.ngx.x86_64
file /usr/sbin/nginx from install of nginx-more-1.16.1-4.el7.x86_64 conflicts with file from package nginx-1:1.17.10-1.el7.ngx.x86_64
file /var/log/nginx from install of nginx-more-1.16.1-4.el7.x86_64 conflicts with file from package nginx-1:1.17.10-1.el7.ngx.x86_64
file /etc/nginx/nginx.conf from install of nginx-more-1.16.1-4.el7.x86_64 conflicts with file from package nginx-1:1.17.10-1.el7.ngx.x86_64
file /usr/share/man/man8/nginx.8.gz from install of nginx-more-1.16.1-4.el7.x86_64 conflicts with file from package nginx-1:1.17.10-1.el7.ngx.x86_64

Error Summary

Nginx-more on Debian 10 - Not an issue, more of a question.

I've been using nginx-more for about 12 months on Centos 7 without any difficulty.

Given that most support for Centos has been dropped, or will be soon, I'm moving this box to a Debian based server.

I'm not an expert in Linux :(

Can this be installed on a Debian distro with reasonable ease?

Thanks.

ModSecurity Module and Configuration

Hi, I install NGINX-More on one of my VPS today and I am very exited to see the features. However, I am bit confused in case of modsecurity as I don't see any configuration or that module installed with Nginx-More?

I am not that expert in modsecurity because I never got chance to use it! Is ModSecurity module already installed with Nginx-More? Or, will I have to install and configure by my own?

Besides, Thank you for all your work! It is a greatest help for free NGINX users!!

Regards

Avoiding serving from cache when cookie is not set (GeoIP/cookie)

Hi Karl,

We have several websites for different geographical locations (AU, US, UK, NZ).
When a first time visitor comes the Geolocation of the client (GeoLoc) is compared with the website's location (WebLoc).

  • If GeoLoc is within the catchment area of WebLoc then we let the client browse the website.
  • If GeoLoc is not withing the catchment area of WebLoc we use a plugin called "modal-window" to show a popup suggesting redirection to the appropriate website. In doing so a cookie will be created with the ID of the zone/WebLoc (wow-modal-id-1=yes or wow-modal-id-2=yes or wow-modal-id-3=yes or wow-modal-id-4=yes) if the client decides to stay on the "wrong" website.

The issue that I was having is that since I installed nginx-more new visitors were served pages from the cache with a popup suggesting a redirection that was not appropriate for their GeoLoc. php-fpm was not reached.

I am using : /etc/nginx/conf.d/custom/fpm-wordpress-cache-users.conf

After some research I came up with the following modification for "fpm-wordpress-cache-users.conf " in an attempt to bypass the cache for clients who did not receive a cookie saying that they accepted to stay on the website (=new visitors):

Solution 1 - This seems to work:

if ($http_cookie !~* "wow-modal-id-1=yes|wow-modal-id-2=yes|wow-modal-id-3=yes|wow-modal-id-4=yes") {
        set $skip_cache 1;
}

Solution 2 - I was also considering the following but did not try it as Solution 1 works:

if ($cookie_wow-modal-id-1 != "yes") {
        set $skip_cache 1;
}
if ($cookie_wow-modal-id-2 != "yes") {
        set $skip_cache 1;
}
if ($cookie_wow-modal-id-3 != "yes") {
        set $skip_cache 1;
}
if ($cookie_wow-modal-id-4 != "yes") {
        set $skip_cache 1;
}

Solution 1 seems to work perfectly in case the visitor comes to the wrong website as the cache is BYPASS until one of the wow-modal-id-* is activated by the user closing the popup and choosing to stay on the "wrong" website.

New issue:
The issue is now that if the visitor comes to the correct website for their GeoLoc then "modal-window" is not triggered so wow-modal-id-* cookie is not established so all the pages are BYPASS which is not desireable.

To correct this behavior I now created a new cookie (Z-Visted=yes) that is given when we established that the visitor is on the correct website then I modified Solution 1 to include it:

if ($http_cookie !~* "Z-Visited=yes|wow-modal-id-1=yes|wow-modal-id-2=yes|wow-modal-id-3=yes|wow-modal-id-4=yes") {
        set $skip_cache 1;
}

Questions:
1- I was wondering if you already created a solution to address these kind of issues in Nginx-More and if you had a more elegant way to do it?
2- I was wondering what happen to the *.conf files like "fpm-wordpress-cache-users.conf" in case of update of nginx-more?
=> Should I put all the changes in a custom *.conf file to avoid to be overwritten?

Thank you very much Karl.

modsecurity

Hello, it doesn't look the modsecuirty is being installed or enabled rpm install on Centos 7? Unless i am missing something.

yum install nginx-more
Package nginx-more-1.16.1-2.el7.x86_64 already installed and latest version
Nothing to do

nginx -t
nginx: [emerg] unknown directive "ModSecurityEnabled" in /etc/nginx/nginx.conf:187
nginx: configuration file /etc/nginx/nginx.conf test failed

2>&1 nginx -V | tr -- - '\n' | grep _module
http_ssl_module
http_realip_module
http_addition_module
http_image_filter_module
http_sub_module
http_dav_module
http_flv_module
http_mp4_module
http_gunzip_module
http_gzip_static_module
http_geoip_module
http_random_index_module
http_secure_link_module
http_degradation_module
http_stub_status_module
http_auth_request_module
http_xslt_module
http_v2_module
mail_ssl_module
stream_ssl_module
stream_realip_module
http_slice_module
stream_ssl_preread_module
module=modules/ngx_module_vts
module=modules/ngx_http_geoip2_module

NGINX-more v1.24 Stable Update

Hi, Please compile and update nginx-more to v1.24 with modules as NGINX stable 1.24 just got released 2 days ago!

Thanks

el9 support

I started working on el9 support for nginx-more. There's only issues so far with two modules: PageSpeed and VTS.

I will keep this issue for tracking el9 release.

ngx_http_geoip2_module

I love your nginx-more :)

However, each updates, I have to go and recompile this module https://github.com/leev/ngx_http_geoip2_module with the new nginx version to be able to add it to your packages.

Would you mind adding it by default? I'm sure many people would benefit as it's required to play with MaxMind Geoip2 new formats

Thanks ! :)

CentOS 8

Just wondering what the plan for CentOS 8 is for this great project.

Nginx 1.18

Hi when is the build for nginx 1.18 coming ?

Problem with modsecurity in version nginx-more-1.16.1-4.el7.x86_64

Hello Karl, I congratulate you for your excellent work, I have been using your compilations for more than 3 years with excellent results, I started testing modsecurity through the testing branch and everything was going well until today to update the latest version, at which time nginx It gave me an error and does not recognize the syntheses that refer to modsecurity.
nginx: [emerg] unknown directive "modsecurity" in

greeting

Pagespeed Module Not Updated

Hi, I see that we are using nginx-more pagespeed module release 1.13.35.2.

But, I came to know v1.14.36.1 was already released on July 2020.

So, why don't we use the latest version 1.14.36.1 instead?

If possible, plz update!

Thanks

Error 502

Hi Karl,

I know it is going to be a stupid question and I am very sorry for that but I am just beginning and have been trying to find the solution for 2 days.
I just can't find why PHP is not working with nginx-more.
Could you please put me in the right direction?

I deactivated SELinux for the tests just to be sure it is not on the way.

I installed nginx-more on a Google-Cloud instance.
Here is the config:

  • Centos8
  • nginx-more (nginx/1.18.0),
  • mysql Ver 8.0.19-10 for Linux on x86_64 (Percona Server (GPL), Release 10, Revision f446c04)
  • PHP 7.4.7 (cli) (built: Jun 9 2020 10:57:17) ( NTS )

Nginx works
=> I can see /usr/share/nginx/html/index.html when browsing the IP.

However, I cannot see any PHP files.
=> when creating /usr/share/nginx/html/phpinfo.php and visiting the IP/phpinfo.php
I get NGINX / 502 Bad Gateway
So I Nginx works but php-fpm is not responding apparently?

I do not understand as /etc/php-fpm.d/www.conf is pointing to /run/php-fpm/www.sock.
The same install with normal Nginx works out of the box.

Here are the status:

sudo systemctl status nginx

โ— nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/nginx.service.d
โ””โ”€php-fpm.conf
Active: active (running) since Thu 2020-06-11 14:20:42 AEST; 18min ago
Docs: http://nginx.org/en/docs/
Process: 9607 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
Process: 9527 ExecReload=/bin/kill -s HUP $MAINPID (code=exited, status=0/SUCCESS)
Process: 9610 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
Main PID: 9612 (nginx)
Tasks: 5 (limit: 22150)
Memory: 23.1M
CGroup: /system.slice/nginx.service
โ”œโ”€9612 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
โ”œโ”€9613 nginx: worker process
โ””โ”€9614 nginx: cache manager process

Jun 11 14:20:42 centostest systemd[1]: Stopped nginx - high performance web server.
Jun 11 14:20:42 centostest systemd[1]: Starting nginx - high performance web server...
Jun 11 14:20:42 centostest systemd[1]: nginx.service: Can't open PID file /var/run/nginx.pid (yet?) after start: No such file or directory
Jun 11 14:20:42 centostest systemd[1]: Started nginx - high performance web server.

sudo systemctl status php-fpm

โ— php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2020-06-11 13:12:52 AEST; 1h 41min ago
Main PID: 6762 (php-fpm)
Status: "Processes active: 0, idle: 5, Requests: 6, slow: 0, Traffic: 0req/sec"
Tasks: 6 (limit: 22150)
Memory: 29.2M
CGroup: /system.slice/php-fpm.service
โ”œโ”€6762 php-fpm: master process (/etc/php-fpm.conf)
โ”œโ”€6763 php-fpm: pool www
โ”œโ”€6764 php-fpm: pool www
โ”œโ”€6765 php-fpm: pool www
โ”œโ”€6766 php-fpm: pool www
โ””โ”€6767 php-fpm: pool www

Jun 11 13:12:52 centostest systemd[1]: Stopped The PHP FastCGI Process Manager.
Jun 11 13:12:52 centostest systemd[1]: Starting The PHP FastCGI Process Manager...
Jun 11 13:12:52 centostest systemd[1]: Started The PHP FastCGI Process Manager.

sudo systemctl status mysql

โ— mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-06-10 23:36:49 AEST; 15h ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 944 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 1796 (mysqld)
Status: "Server is operational"
Tasks: 40 (limit: 22150)
Memory: 550.4M
CGroup: /system.slice/mysqld.service
โ””โ”€1796 /usr/sbin/mysqld

Jun 10 23:36:37 centostest systemd[1]: Starting MySQL Server...
Jun 10 23:36:49 centostest systemd[1]: Started MySQL Server.

Thanks a lot

nginx-more-1.22.1-1.el8.x86_64 breaks ngx_cache_purge

Dear nginx-more maintainer,

with nginx-more-1.22.1-1.el8.x86_64, ngx_cache_purge crashes:

[root@<redacted> ~]# curl -D- -X PURGE http://<redacted>.rz.uni-osnabrueck.de/proxy-cache-test/test.html
curl: (52) Empty reply from server

with nginx-more-1.18.0-4.el8.x86_64 (last working version with ngx_cache_purge), everything is fine:

# curl -D- -X PURGE http://<redacted>.rz.uni-osnabrueck.de/proxy-cache-test/test.html
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 06 Dec 2022 14:15:00 GMT
Content-Type: text/html
Content-Length: 288
Connection: keep-alive

<html>
<head><title>Successful purge</title></head>
<body bgcolor="white">
<center><h1>Successful purge</h1>
<br>Key : /proxy-cache-test/test.html
<br>Path: /var/cache/nginx/proxy/4/56/db27baca3d683b4fa84088b4549c0564
</center>
<hr><center>nginx/1.18.0</center>
</body>
</html>

This might be solved by:

FRiCKLE/ngx_cache_purge@c8ca321

Thanx in advance!
Frank

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.