Skip to content

Update NGINX installation from v1.22.1 to 1.29.8 + QOL#62

Merged
Ym0T merged 9 commits intoYm0T:mainfrom
Frerduro:patch-2
Apr 12, 2026
Merged

Update NGINX installation from v1.22.1 to 1.29.8 + QOL#62
Ym0T merged 9 commits intoYm0T:mainfrom
Frerduro:patch-2

Conversation

@Frerduro
Copy link
Copy Markdown
Contributor

@Frerduro Frerduro commented Apr 11, 2026

  • Following https://nginx.org/en/linux_packages.html#Debian to switch NGINX install from default NGINX install from debian default install to instead use mainline
  • Minor change to modules/nginx/start.sh to add -e /dev/stderr to startup for better startup error logging.
  • Changed nginx/conf.d/default.conf to include cloudflare realip. Additionally commented out logging configured in that file due to it overriding what is configured in nginx/nginx.conf already I am unsure if you would prefer just removing the configuration from nginx/conf.d/default.conf instead of commenting it out.
  • Additional minor changes to nginx/nginx.conf to better align container logging. Both /dev/stderr and /dev/stdout work in pterodactyl due to it merging both into the same console output.

I have tested these changes via ghcr.io/frerduro/pterodactyl-nginx-egg:8.5-latest and have not found any issues so far.

Current NGINX version installed is 1.22.1 which released in 2022 this follows https://nginx.org/en/linux_packages.html#Debian to install mainline NGINX packages
Redirect NGINX error logs to stderr.
Commented out the console access log line with a note about its verbosity.
Comment out access and error log directives to prevent overriding existing configurations.
Removed manual trigger for workflow dispatch.
@Ym0T
Copy link
Copy Markdown
Owner

Ym0T commented Apr 11, 2026

Thank you for your contribution. I will take a look at everything and test it over the weekend.

@Ym0T Ym0T self-assigned this Apr 11, 2026
@Ym0T Ym0T self-requested a review April 11, 2026 23:57
- Fix set_real_ip_from 127.0.0.1 since requests arrive from the local
  cloudflared process, not from the Docker network
- Use CF-Connecting-IP header to correctly resolve the real client IP
  set by Cloudflare
Copy link
Copy Markdown
Owner

@Ym0T Ym0T left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! I adjusted the real IP configuration slightly since Cloudflare Tunnel runs inside the container itself, requests to nginx always arrive from 127.0.0.1 (the local cloudflared process), not from the Docker network (172.18.0.0/16). I also switched the header from X-Forwarded-For to CF-Connecting-IP which is the header Cloudflare sets with the actual client IP. Everything else looks good and has been included!

@Ym0T Ym0T merged commit 8d566da into Ym0T:main Apr 12, 2026
4 checks passed
@Frerduro
Copy link
Copy Markdown
Contributor Author

Frerduro commented Apr 12, 2026

Thanks for the contribution! I adjusted the real IP configuration slightly since Cloudflare Tunnel runs inside the container itself, requests to nginx always arrive from 127.0.0.1 (the local cloudflared process), not from the Docker network (172.18.0.0/16). I also switched the header from X-Forwarded-For to CF-Connecting-IP which is the header Cloudflare sets with the actual client IP. Everything else looks good and has been included!

Huh weird sorry for missing that. When I was testing my changes 172.18.0.0/16 worked fine and I guess I didn't investigate it further.

@Ym0T
Copy link
Copy Markdown
Owner

Ym0T commented Apr 13, 2026

Thanks for the contribution! I adjusted the real IP configuration slightly since Cloudflare Tunnel runs inside the container itself, requests to nginx always arrive from 127.0.0.1 (the local cloudflared process), not from the Docker network (172.18.0.0/16). I also switched the header from X-Forwarded-For to CF-Connecting-IP which is the header Cloudflare sets with the actual client IP. Everything else looks good and has been included!

Huh weird sorry for missing that. When I was testing my changes 172.18.0.0/16 worked fine and I guess I didn't investigate it further.

No worries! I tested both configurations on my test server running WordPress with Cloudflare Tunnel using standard Pterodactyl/Docker configurations and your version with 172.18.0.0/16 didn't work, the real IP was never resolved and all requests showed 127.0.0.1 in the logs. I was also wondering why the Docker network range would even be used here, since Cloudflare Tunnel runs inside the container itself and therefore all requests to nginx come from 127.0.0.1 directly. Either way, switching to set_real_ip_from 127.0.0.1 with CF-Connecting-IP fixed it immediately and should work reliably for everyone using Cloudflare Tunnel with the standard setup of this egg.

@Frerduro
Copy link
Copy Markdown
Contributor Author

Thanks for the contribution! I adjusted the real IP configuration slightly since Cloudflare Tunnel runs inside the container itself, requests to nginx always arrive from 127.0.0.1 (the local cloudflared process), not from the Docker network (172.18.0.0/16). I also switched the header from X-Forwarded-For to CF-Connecting-IP which is the header Cloudflare sets with the actual client IP. Everything else looks good and has been included!

Huh weird sorry for missing that. When I was testing my changes 172.18.0.0/16 worked fine and I guess I didn't investigate it further.

No worries! I tested both configurations on my test server running WordPress with Cloudflare Tunnel using standard Pterodactyl/Docker configurations and your version with 172.18.0.0/16 didn't work, the real IP was never resolved and all requests showed 127.0.0.1 in the logs. I was also wondering why the Docker network range would even be used here, since Cloudflare Tunnel runs inside the container itself and therefore all requests to nginx come from 127.0.0.1 directly. Either way, switching to set_real_ip_from 127.0.0.1 with CF-Connecting-IP fixed it immediately and should work reliably for everyone using Cloudflare Tunnel with the standard setup of this egg.

I figured it out on my end requests are coming from 172.18.0.1 when I use cloudflared tunnel built into this egg not 127.0.0.1 that is why it was working on my end when I was making my changes.

@Frerduro Frerduro mentioned this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants