Giter Club home page Giter Club logo

docker-nginx's Introduction

linuxserver.io

Blog Discord Discourse Fleet GitHub Open Collective

The LinuxServer.io team brings you another container release featuring:

  • regular and timely application updates
  • easy user mappings (PGID, PUID)
  • custom base image with s6 overlay
  • weekly base OS updates with common layers across the entire LinuxServer.io ecosystem to minimise space usage, down time and bandwidth
  • regular security updates

Find us at:

  • Blog - all the things you can do with our containers including How-To guides, opinions and much more!
  • Discord - realtime support / chat with the community and the team.
  • Discourse - post on our community forum.
  • Fleet - an online web interface which displays all of our maintained images.
  • GitHub - view the source for all of our repositories.
  • Open Collective - please consider helping us by either donating or contributing to our budget

Scarf.io pulls GitHub Stars GitHub Release GitHub Package Repository GitLab Container Registry Quay.io Docker Pulls Docker Stars Jenkins Build LSIO CI

Nginx is a simple webserver with php support. The config files reside in /config for easy user customization.

nginx

Supported Architectures

We utilise the docker manifest for multi-platform awareness. More information is available from docker here and our announcement here.

Simply pulling lscr.io/linuxserver/nginx:latest should retrieve the correct image for your arch, but you can also pull specific arch images via tags.

The architectures supported by this image are:

Architecture Available Tag
x86-64 amd64-<version tag>
arm64 arm64v8-<version tag>
armhf

Application Setup

Add your web files to /config/www for hosting. Modify the nginx, php and site config files under /config as needed

Usage

To help you get started creating a container from this image you can either use docker-compose or the docker cli.

docker-compose (recommended, click here for more info)

---
services:
  nginx:
    image: lscr.io/linuxserver/nginx:latest
    container_name: nginx
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - /path/to/nginx/config:/config
    ports:
      - 80:80
      - 443:443
    restart: unless-stopped
docker run -d \
  --name=nginx \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Etc/UTC \
  -p 80:80 \
  -p 443:443 \
  -v /path/to/nginx/config:/config \
  --restart unless-stopped \
  lscr.io/linuxserver/nginx:latest

Parameters

Containers are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate <external>:<internal> respectively. For example, -p 8080:80 would expose port 80 from inside the container to be accessible from the host's IP on port 8080 outside the container.

Parameter Function
-p 80 http
-p 443 https
-e PUID=1000 for UserID - see below for explanation
-e PGID=1000 for GroupID - see below for explanation
-e TZ=Etc/UTC specify a timezone to use, see this list.
-v /config Persistent config files

Environment variables from files (Docker secrets)

You can set any environment variable from a file by using a special prepend FILE__.

As an example:

-e FILE__MYVAR=/run/secrets/mysecretvariable

Will set the environment variable MYVAR based on the contents of the /run/secrets/mysecretvariable file.

Umask for running applications

For all of our images we provide the ability to override the default umask settings for services started within the containers using the optional -e UMASK=022 setting. Keep in mind umask is not chmod it subtracts from permissions based on it's value it does not add. Please read up here before asking for support.

User / Group Identifiers

When using volumes (-v flags), permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user PUID and group PGID.

Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.

In this instance PUID=1000 and PGID=1000, to find yours use id your_user as below:

id your_user

Example output:

uid=1000(your_user) gid=1000(your_user) groups=1000(your_user)

Docker Mods

Docker Mods Docker Universal Mods

We publish various Docker Mods to enable additional functionality within the containers. The list of Mods available for this image (if any) as well as universal mods that can be applied to any one of our images can be accessed via the dynamic badges above.

Support Info

  • Shell access whilst the container is running:

    docker exec -it nginx /bin/bash
  • To monitor the logs of the container in realtime:

    docker logs -f nginx
  • Container version number:

    docker inspect -f '{{ index .Config.Labels "build_version" }}' nginx
  • Image version number:

    docker inspect -f '{{ index .Config.Labels "build_version" }}' lscr.io/linuxserver/nginx:latest

Updating Info

Most of our images are static, versioned, and require an image update and container recreation to update the app inside. With some exceptions (noted in the relevant readme.md), we do not recommend or support updating apps inside the container. Please consult the Application Setup section above to see if it is recommended for the image.

Below are the instructions for updating containers:

Via Docker Compose

  • Update images:

    • All images:

      docker-compose pull
    • Single image:

      docker-compose pull nginx
  • Update containers:

    • All containers:

      docker-compose up -d
    • Single container:

      docker-compose up -d nginx
  • You can also remove the old dangling images:

    docker image prune

Via Docker Run

  • Update the image:

    docker pull lscr.io/linuxserver/nginx:latest
  • Stop the running container:

    docker stop nginx
  • Delete the container:

    docker rm nginx
  • Recreate a new container with the same docker run parameters as instructed above (if mapped correctly to a host folder, your /config folder and settings will be preserved)

  • You can also remove the old dangling images:

    docker image prune

Image Update Notifications - Diun (Docker Image Update Notifier)

tip: We recommend Diun for update notifications. Other tools that automatically update containers unattended are not recommended or supported.

Building locally

If you want to make local modifications to these images for development purposes or just to customize the logic:

git clone https://github.com/linuxserver/docker-nginx.git
cd docker-nginx
docker build \
  --no-cache \
  --pull \
  -t lscr.io/linuxserver/nginx:latest .

The ARM variants can be built on x86_64 hardware using multiarch/qemu-user-static

docker run --rm --privileged multiarch/qemu-user-static:register --reset

Once registered you can define the dockerfile to use with -f Dockerfile.aarch64.

Versions

  • 31.05.24: - Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings.
  • 05.03.24: - Rebase to Alpine 3.19 with php 8.3.
  • 25.05.23: - Rebase to Alpine 3.18, deprecate armhf.
  • 16.01.23: - Remove nchan module because it keeps causing crashes.
  • 22.12.22: - Rebase to Alpine 3.17 with PHP 8.1, migrate to s6v3.
  • 20.08.22: - Rebasing to alpine 3.15 with php8. Restructure nginx configs (see changes announcement).
  • 22.05.22: - Install nginx version from 3.14.
  • 01.07.21: - Rebasing to alpine 3.14.
  • 24.06.21: - Update default nginx conf folder.
  • 12.04.21: - Add php7-gmp and php7-pecl-mailparse.
  • 13.02.21: - Remove php7-pecl-imagick (it now installs the full imagemagick with too much crud). Users can install it via this docker mod.
  • 09.02.21: - Rebasing to alpine 3.13. Add nginx mods brotli and dav-ext. Remove nginx mods lua and lua-upstream (due to regression over the last couple of years).
  • 08.09.20: - Add php7-xsl.
  • 01.06.20: - Rebasing to alpine 3.12.
  • 18.04.20: - Fix unwanted shutdown of the container.
  • 11.03.20: - Add php7-sodium.
  • 18.02.20: - Add geoip2, suppress lua warning.
  • 19.12.19: - Rebasing to alpine 3.11.
  • 18.12.19: - Add php7-imap and php7-pecl-apcu.
  • 13.11.19: - Add php7-pdo_odbc.
  • 24.10.19: - Add php7-pecl-imagick.
  • 06.08.19: - Add php7-bcmath, ph7-pear, php7-xmlrpc and php7-ftp.
  • 02.08.19: - Add php7-ldap.
  • 28.06.19: - Rebasing to alpine 3.10.
  • 08.05.19: - Remove default.conf when nginx is upgraded in downstream image.
  • 30.04.19: - Add php-redis.
  • 23.03.19: - Switching to new Base images, shift to arm32v7 tag.
  • 02.03.19: - Add php intl and posix modules.
  • 28.02.19: - Add php7-opcache, remove memcached service due to issues on aarch64 (let us know if you need to enable it).
  • 22.02.19: - Rebasing to alpine 3.9.
  • 18.11.18: - Attempt to upgrade packages during build.
  • 28.09.18: - Multi-arch image.
  • 17.08.18: - Rebase to alpine 3.8, inherit nginx.conf from nginx baseimage.
  • 11.05.18: - Add php pgsql support.
  • 19.04.18: - Bind memcached to localhost only, add php7-sqlite3.
  • 05.01.18: - Rebase to alpine 3.7.
  • 08.11.17: - Add php7 soap module.
  • 31.10.17: - Add php7 exif and xmlreader modules.
  • 30.09.17: - Copy additional root files into image.
  • 24.09.17: - Add memcached service.
  • 31.08.17: - Add php7-phar.
  • 14.07.17: - Enable modules dynamically in nginx.conf.
  • 22.06.17: - Add various nginx modules and enable all modules in the default nginx.conf.
  • 05.06.17: - Add php7-bz2.
  • 25.05.17: - Rebase to alpine 3.6.
  • 18.04.17: - Add php7-sockets.
  • 27.02.17: - Rebase to alpine 3.5, update to nginx 1.10.2 and php7.
  • 14.10.16: - Add version layer information.
  • 10.09.16: - Add badges to README.
  • 05.12.15: - Intial Release.

docker-nginx's People

Contributors

aptalca avatar chbmb avatar j0nnymoe avatar keltgourig avatar linuxserver-ci avatar lonix avatar machsix avatar nemchik avatar roxedus avatar smdion avatar sparklyballs avatar spunkie avatar thelamer avatar thespad avatar tobbenb 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

docker-nginx's Issues

PHP version

Hi,
The latest version is PHP7.3, but my application can only run PHP7.2, how do I run PHP7.2, or specify the version , Thanks

lua cjson

Can you add these 2 packages to this and the letsencrypt image? I am implementing a lua google oauth script and it relies upon these 2.

lua5.1-resty-http
lua5.1-cjson

adding php_sodium extension

Is it possible to include php_sodium for better crypto support? instead of relying on the long dead mcrypt extension which is absolute and hasn't been updated in ages.

Thank you.

add MSSQL support

Hello linuxserver,

Can you add MSSQL support for PHP to the docker image?

Best regards,

Vincent

[BUG] [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When updating to commit 362205c, I found that page load attempts would get an 502 Gateway error after today's rebase to Alpine 3.17.

The following error will fill the logs:
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3

Expected Behavior

The website should load.

Steps To Reproduce

  1. Update to today's commit 362205c using unRAID 6.11.5
  2. Observe error 'nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3' and pages not load

Environment

- OS: unRAID 6.11.5
- How docker service was installed:

CPU architecture

x86-64

Docker creation

docker run
  -d
  --name='Webserver'
  --net='br0'
  --ip='192.168.50.3'
  -e TZ="America/Chicago"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME="Nyx"
  -e HOST_CONTAINERNAME="Webserver"
  -e 'TCP_PORT_80'='80'
  -e 'TCP_PORT_443'='443'
  -e 'PUID'='99'
  -e 'PGID'='100'
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.webui='http://[IP]:[PORT:80]/'
  -l net.unraid.docker.icon='https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/nginx-icon.png'
  -v '/tmp/webserver_logs/':'/config/log/nginx/':'rw'
  -v '/mnt/user/appdata/webserver':'/config':'rw' 'linuxserver/nginx' 
b736bf0685c710308e6372b51dbee525ecada9085470fba7a7739f8cc88a03ad

Container logs

[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] done

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/


Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    99
User gid:    100
-------------------------------------

using keys found in /config/keys
**** The following active confs have different version dates than the samples that are shipped. ****
**** This may be due to user customization or an update to the samples. ****
**** You should compare the following files to the samples in the same folder and update them. ****
**** Use the link at the top of the file to view the changelog. ****
/config/nginx/nginx.conf
/config/nginx/ssl.conf
/config/nginx/site-confs/default.conf

[custom-init] No custom files found, skipping...
[ls.io-init] done.
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3

Manually adding geoip2 crashes docker

Followed instruction "Starting 2019/12/30, GeoIP2 databases require personal license key to download. Please manually download/update the GeoIP2 db and save as /config/geoip2db/GeoLite2-City.mmdb"

After manually adding the db in the instructed directory, the docker crashes. No logs created

Environment

Unraid

Command used to create docker container

Sample docker-compose

ION Cube loader on docker-Nginx

Is this a new feature request?

  • I have searched the existing issues

Wanted change

Ioncube loader on docker-compose with nginx

Reason for change

have some program that needed it insite

Proposed code change

No response

Finding the last version of history with php 7.4

Is this a new feature request?

  • I have searched the existing issues

Wanted change

I need to deploy an application using php 7.4 (php8 is not supported in this program). Since linuxserver/nginx has been updated to 8.3 and hundreds of versions, how do I quickly find a historical version that supports 7.4?

Reason for change

I'd like to find the latest old version, please.

Proposed code change

No response

add php extensions?

Is it possible to add add the php imap and APCu extensions?

I hope this is the correct place to do this request.

Ioncube Mod not working with PHP8.0

Hi i would like to use the MOD Ioncube but unfortunately it doesnt work with the current php Version. Is it possible to update PHP to the current version?


Expected Behavior

NGINX should work with Ioncube again

Current Behavior

Ioncube MOD doesnt work with current PHP Version 8.0

Steps to Reproduce

Environment

Unraid
CPU architecture: x86_64
How docker service was installed: Via CA

Add ImageMagick?

Would there be any chance of having ImageMagick for PHP added?

default.conf being created

linuxserver.io


Expected Behavior

When restarting or redeploying nginx with an existing volume, it should not be recreating
/config/nginx/site-confs/default.conf or /config/nginx/site-confs/default.conf.sample

Current Behavior

When nginx is restarted or the stack it is a part of is restarted the following files are created with causes nginx to break because there is invalid paths
/config/nginx/site-confs/default.conf or /config/nginx/site-confs/default.conf.sample

Steps to Reproduce

root@7f26a2aa7975:/config/nginx/site-confs# ls
site-one.conf site-two.conf

-container restarted from cli-
root@7f26a2aa7975:/config/nginx/site-confs# ls
default.conf default.conf.sample site-one.conf site-two.conf

If I rm the files from within the container OR via the host, as soon as I restart the container, the two default configs return

Environment

OS: Debian GNU/Linux 11 (bullseye)
CPU architecture: x86_64
How docker service was installed:
The official docker repo (linuxserver/nginx:latest) via a stack configured on Proxmox

Command used to create docker container (run/create/compose/screenshot)

version: "3.6"
services:
nginx:
image: linuxserver/nginx:latest
container_name: nginx
environment:
- PUID=1000
- PGID=1000
- TZ=America/Denver
volumes:
- /docker/nginx:/config
- /etc/letsencrypt/archive:/etc/letsencrypt/archive:ro
- /etc/letsencrypt/live:/etc/letsencrypt/live:ro
ports:
- 80:80
- 443:443
restart: unless-stopped

Docker logs

User uid: 1000
User gid: 1000
cont-init: info: /etc/cont-init.d/10-adduser exited 0
cont-init: info: running /etc/cont-init.d/11-folders
cont-init: info: /etc/cont-init.d/11-folders exited 0
cont-init: info: running /etc/cont-init.d/12-samples
cont-init: info: /etc/cont-init.d/12-samples exited 0
cont-init: info: running /etc/cont-init.d/13-nginx
cont-init: info: /etc/cont-init.d/13-nginx exited 0
cont-init: info: running /etc/cont-init.d/14-php
cont-init: info: /etc/cont-init.d/14-php exited 0
cont-init: info: running /etc/cont-init.d/15-keygen
using keys found in /config/keys
cont-init: info: /etc/cont-init.d/15-keygen exited 0
cont-init: info: running /etc/cont-init.d/20-permissions
cont-init: info: /etc/cont-init.d/20-permissions exited 0
cont-init: info: running /etc/cont-init.d/70-outdated
cont-init: info: /etc/cont-init.d/70-outdated exited 0
cont-init: info: running /etc/cont-init.d/85-version-checks
**** The following active confs have different version dates than the samples that are shipped. ****
**** This may be due to user customization or an update to the samples. ****
**** You should compare the following files to the samples in the same folder and update them. ****
**** Use the link at the top of the file to view the changelog. ****
/config/nginx/nginx.conf
cont-init: info: /etc/cont-init.d/85-version-checks exited 0
cont-init: info: running /etc/cont-init.d/90-custom-folders
cont-init: info: /etc/cont-init.d/90-custom-folders exited 0
cont-init: info: running /etc/cont-init.d/99-custom-files
[custom-init] no custom files found exiting...
cont-init: info: /etc/cont-init.d/99-custom-files exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-mods: starting
s6-rc: info: service init-mods successfully started
s6-rc: info: service init-mods-package-install: starting
s6-rc: info: service init-mods-package-install successfully started
s6-rc: info: service init-mods-end: starting
s6-rc: info: service init-mods-end successfully started
s6-rc: info: service init-services: starting
s6-rc: info: service init-services successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun cron (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
services-up: info: copying legacy longrun php-fpm (no readiness notification)
s6-rc: info: service legacy-services successfully started
s6-rc: info: service 99-ci-service-check: starting
[ls.io-init] done.
s6-rc: info: service 99-ci-service-check successfully started
nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /config/nginx/site-confs/default.conf:3
--last line repeats several thousand times

nginx: [emerg] unknown directive "lua_load_resty_core" in /config/nginx/nginx.conf:88 in latest image

Expected Behavior

The docker image tagged "latest" should run without any errors ;)

Current Behavior / Steps to Reproduce

Booting the docker image tagged latest as of now (version-333315c5), the following error is thrown:

nginx: [emerg] unknown directive "lua_load_resty_core" in /config/nginx/nginx.conf:88

Going back to an older image (version-25aad05b) does not have this issue.

Environment

OS: Debian 10
CPU architecture: x86_64
How docker service was installed: Via the docker docs instructions

Command used to create docker container (run/create/compose/screenshot)

docker-compose up -d

Docker logs

> docker-compose logs nginx
Attaching to nginx
nginx            | [mod-init] Attempting to run Docker Modification Logic
nginx            | [mod-init] Applying linuxserver/mods:nginx-proxy-confs files to container
nginx            | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
nginx            | [s6-init] ensuring user provided files have correct perms...exited 0.
nginx            | [fix-attrs.d] applying ownership & permissions fixes...
nginx            | [fix-attrs.d] done.
nginx            | [cont-init.d] executing container initialization scripts...
nginx            | [cont-init.d] 01-envfile: executing... 
nginx            | [cont-init.d] 01-envfile: exited 0.
nginx            | [cont-init.d] 10-adduser: executing... 
nginx            | 
nginx            | -------------------------------------
nginx            |           _         ()
nginx            |          | |  ___   _    __
nginx            |          | | / __| | |  /  \ 
nginx            |          | | \__ \ | | | () |
nginx            |          |_| |___/ |_|  \__/
nginx            | 
nginx            | 
nginx            | Brought to you by linuxserver.io
nginx            | -------------------------------------
nginx            | 
nginx            | To support LSIO projects visit:
nginx            | https://www.linuxserver.io/donate/
nginx            | -------------------------------------
nginx            | GID/UID
nginx            | -------------------------------------
nginx            | 
nginx            | User uid:    1000
nginx            | User gid:    1000
nginx            | -------------------------------------
nginx            | 
nginx            | [cont-init.d] 10-adduser: exited 0.
nginx            | [cont-init.d] 20-config: executing... 
nginx            | [cont-init.d] 20-config: exited 0.
nginx            | [cont-init.d] 30-keygen: executing... 
nginx            | using keys found in /config/keys
nginx            | [cont-init.d] 30-keygen: exited 0.
nginx            | [cont-init.d] 40-config: executing... 
nginx            | Removing lua specific info from nginx.conf
nginx            | Starting 2019/12/30, GeoIP2 databases require personal license key to download. Please manually download/update the GeoIP2 db and save as /config/geoip2db/GeoLite2-City.mmdb
nginx            | [cont-init.d] 40-config: exited 0.
nginx            | [cont-init.d] 99-custom-files: executing... 
nginx            | [custom-init] no custom files found exiting...
nginx            | [cont-init.d] 99-custom-files: exited 0.
nginx            | [cont-init.d] 99-proxy-conf: executing... 
nginx            | [cont-init.d] 99-proxy-conf: exited 0.
nginx            | [cont-init.d] done.
nginx            | [services.d] starting services
nginx            | nginx: [emerg] unknown directive "lua_load_resty_core" in /config/nginx/nginx.conf:88
nginx            | [services.d] done.
nginx            | nginx: [emerg] unknown directive "lua_load_resty_core" in /config/nginx/nginx.conf:88
nginx            | nginx: [emerg] unknown directive "lua_load_resty_core" in /config/nginx/nginx.conf:88 
...

Thank you for your work. I am happy to provide more context if necessary.

Docker image fails to start

linuxserver.io


Expected Behavior

Latest nginx docker image (image ID: e70f8c94d769) starts using docker-compose.

Current Behavior

When starting the image with docker-copose, the container never runs (it directly exits, only visible using docker ps -a).

Steps to Reproduce

  1. Create a docker-compose file with the below configuration
  2. run docker-compose -f <your-docker-compose-file> up -d

I don't know if this would be relevant but I created a Swarm with 2 nodes and running docker-compose on one of the nodes before deploying the service. The service has never been deployed as nginx is currently failing.

Environment

OS: Ubuntu 18.04 server
CPU architecture: x86_64
How docker service was installed: Official documentation from docker website
Docker version: Docker version 19.03.5, build 633a0ea838
docker-compose version: docker-compose version 1.25.0, build 0a186604

Command used to create docker container

docker-compose -f test.yml up -d

test.yml docker-compose file:

version: '3.7'
networks:
    cluster:
        driver: bridge    
services:
    nginx:
        image: linuxserver/nginx
        entrypoint: nginx
        container_name: nginx
        ports:
            - 80:80
        networks:
            cluster:
                aliases:
                    - nginx

Docker logs

nginx: [alert] detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https://github.com/openresty/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https://openresty.org/en/download.html)
nginx: [error] lua_load_resty_core failed to load the resty.core module from https://github.com/openresty/lua-resty-core; ensure you are using an OpenResty release from https://openresty.org/en/download.html (rc: 2, reason: module 'resty.core' not found:
	no field package.preload['resty.core']
	no file './resty/core.lua'
	no file '/usr/share/luajit-2.1.0-beta3/resty/core.lua'
	no file '/usr/local/share/lua/5.1/resty/core.lua'
	no file '/usr/local/share/lua/5.1/resty/core/init.lua'
	no file '/usr/share/lua/5.1/resty/core.lua'
	no file '/usr/share/lua/5.1/resty/core/init.lua'
	no file '/usr/share/lua/common/resty/core.lua'
	no file '/usr/share/lua/common/resty/core/init.lua'
	no file './resty/core.so'
	no file '/usr/local/lib/lua/5.1/resty/core.so'
	no file '/usr/lib/lua/5.1/resty/core.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
	no file './resty.so'
	no file '/usr/local/lib/lua/5.1/resty.so'
	no file '/usr/lib/lua/5.1/resty.so'
	no file '/usr/local/lib/lua/5.1/loadall.so')
nginx: [emerg] open() "/run/nginx/nginx.pid" failed (2: No such file or directory)

Provide nginx build focused on secure proxying.

Two main suggestions here:

  • Run nginx as an underprivileged user by default.
  • Run nginx only with proxy-focused modules, not webserver modules.

This will provide a more secure, default out-of-box LS nginx configuration.

Working assumptions:

  • Most users consume this image to be used as a reverse proxy.
  • Most users are blindly following Internet instructions.

Underprivileged by default.

Run the nginx service with an unprivileged user by default; with UID/GID still able to be specified with the classic LS parameters (PUID/PGID). This will minimize impact in case of a compromise or bug in nginx or the modules themselves.

As it is a docker container, you can still map the external ports to the container correctly, so using unprivileged ports on nginx by default shouldn't be an issue here:

ports:
  - '80:8080'
  - '443:4343'

Proxy only.

The working assumption of consumers of LS images a majority of home gamers setting up nginx solely for reversing proxying and exposing to the internet. The exposed footprint should be minimized focusing on functionality that would not be used.

Propose: remove all PHP packages. from both this image and the underlying base image (even if that is removing them in this layer to produce the image.)

Effectively this is creating a LS nginx release that is focused on proxying with non-root privileges.

Tagging

I'd suggest the following tags for this image:

linxuserver/nginx-proxy
linuxserver/nginx-nophp

Cannot reload nginx

Hi

I cannot reload the configuration using

docker exec -it nginx-server nginx -s reload

as it results in

nginx: [error] open() "/run/nginx/nginx.pid" failed (2: No such file or directory)

add php7-gmp

Can php7-gmp be included in the image? FreshRSS Google Reader API won't work without it.

nginx error.log written to /var/log

Expected Behavior

error.log to be written in /config/nginx/log/error.log

Current Behavior

error.log to be written in /var/log/nginx

Steps to Reproduce

  1. Create an invalid site configuration.
  2. Start nginx
  3. Logs gets written in /var/log/nginx

Environment

OS: Ubuntu 20.04
CPU architecture: x86_64
How docker service was installed:
apt install docker-compose

Command used to create docker container (run/create/compose/screenshot)

  nginx:
    image: ghcr.io/linuxserver/nginx
    container_name: nginx
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Stockholm
    volumes:
      - ./nginx:/config
    ports:
      - 80:80
      - 443:443
    restart: unless-stopped

Docker logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing... 
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing... 

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \ 
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/


Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing... 
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing... 
generating self-signed keys in /config/keys, you can replace these with your own keys if required
Generating a RSA private key
.....................+++++
.....+++++
writing new private key to '/config/keys/cert.key'
-----
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 40-config: executing... 
Starting 2019/12/30, GeoIP2 databases require personal license key to download. Please manually download/update the GeoIP2 db and save as /config/geoip2db/GeoLite2-City.mmdb
[cont-init.d] 40-config: exited 0.
[cont-init.d] 99-custom-files: executing... 
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing... 
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing... 
usermod: no changes

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \ 
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/


Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing... 
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing... 
using keys found in /config/keys
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 40-config: executing... 
Starting 2019/12/30, GeoIP2 databases require personal license key to download. Please manually download/update the GeoIP2 db and save as /config/geoip2db/GeoLite2-City.mmdb
[cont-init.d] 40-config: exited 0.
[cont-init.d] 99-custom-files: executing... 
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11
nginx: [emerg] open() "/config/nginx/proxy-control.conf" failed (2: No such file or directory) in /config/nginx/site-confs/mysite.local:11

Can not run after last update

Expected Behavior

Normaly run the Docker container

Current Behavior

Container can't run at all.

Steps to Reproduce

  1. Get latest Docker image
  2. Update container to this image
  3. Run the container

Environment

OS: Raspbian GNU/Linux 10 (buster)
CPU architecture: ARMv7 Processor rev 5 (v7l)
How docker service was installed:
From official Docker repo. Using Docker Compose

Command used to create docker container (run/create/compose/screenshot)

version: "2.1"
testing:
image: ghcr.io/linuxserver/nginx
container_name: testing
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Sofia
volumes:
- /mnt/testing:/config
ports:
- 8007:80
restart: unless-stopped

Docker logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing...
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing...
usermod: no changes


      _         ()
     | |  ___   _    __
     | | / __| | |  /  \
     | | \__ \ | | | () |
     |_| |___/ |_|  \__/

Brought to you by linuxserver.io

To support LSIO projects visit:
https://www.linuxserver.io/donate/

GID/UID

User uid: 1000
User gid: 1000

chown: changing ownership of '/config': Operation not permitted
[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing...
chown: changing ownership of '/config/nginx/site-confs/default': Operation not permitted
chown: changing ownership of '/config/nginx/site-confs': Operation not permitted
chown: changing ownership of '/config/nginx/nginx.conf': Operation not permitted
chown: changing ownership of '/config/nginx': Operation not permitted
chown: changing ownership of '/config/www/index.html': Operation not permitted
chown: changing ownership of '/config/www': Operation not permitted
chown: changing ownership of '/config/log/nginx': Operation not permitted
chown: changing ownership of '/config/log/php': Operation not permitted
chown: changing ownership of '/config/log': Operation not permitted
chown: changing ownership of '/config/keys/cert.key': Operation not permitted
chown: changing ownership of '/config/keys/cert.crt': Operation not permitted
chown: changing ownership of '/config/keys': Operation not permitted
chown: changing ownership of '/config/php/php-local.ini': Operation not permitted
chown: changing ownership of '/config/php/www2.conf': Operation not permitted
chown: changing ownership of '/config/php': Operation not permitted
chown: changing ownership of '/config/geoip2db': Operation not permitted
chown: changing ownership of '/config/custom-cont-init.d': Operation not permitted
chown: changing ownership of '/config/custom-services.d': Operation not permitted
chown: changing ownership of '/config': Operation not permitted
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing...
using keys found in /config/keys
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 40-config: executing...
Starting 2019/12/30, GeoIP2 databases require personal license key to download. Please manually download/update the GeoIP2 db and save as /config/geoip2db/GeoLite2-City.mmdb
[cont-init.d] 40-config: exited 0.
[cont-init.d] 90-custom-folders: executing...
chown: changing ownership of '/config/custom-cont-init.d': Operation not permitted
chown: changing ownership of '/config/custom-services.d': Operation not permitted
[cont-init.d] 90-custom-folders: exited 1.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

[BUG] please add user 'www-data' in dockerfile

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

There is no 'www-data' user in /etc/passwd, only '/etc/group' has 'www-data' group.

Expected Behavior

Wordpress needs to set wp-content folder to 'www-data' user.
Please add 'adduser -u 82 -D -S -G www-data www-data' command in dockerfile.

Steps To Reproduce

  1. OS: Ubuntu 22.04.1
  2. Install docker.io: sudo apt install docker.io
  3. Create docker container
  4. Execute 'cat /etc/passwd | grep www-data' in container

Environment

- OS: Ubuntu 22.04.1
- How docker service was installed:
  sudo apt install docker.io, docker version: 20.10.25-0ubuntu1~22.04.1

CPU architecture

x86-64

Docker creation

sudo docker run -d \
  --name=nginx \
  --net=host \
  -e PUID=1001 \
  -e PGID=1002 \
  -e TZ=Asia/Shanghai \
  -v /data/docker/nginx:/config \
  --restart unless-stopped \
  linuxserver/nginx:latest

Container logs

container is ok

PHP Version

Can we get the version of php used bumped to 7.4.x please, Wordpress is now warning that 7.3.x is no longer recommended as it is not the current stable version. Thank you.

Screen Shot 2020-06-28 at 10 09 51 AM

Docker version not incremented (still 1.20.2) despite modification that altered functionality.

linuxserver.io


Expected Behavior

I expect that if you do ANY change in the code, the docker version should be incremented.

Current Behavior

I was running docker version 1.20.2 (FROM linuxserver/nginx:1.20.2) without any problem since the beginning of this year, but since a couple of weeks ago my testing script started to report errors. I spend a looooong time trying to debug the issue and I discovered that someone decided to change the name of the default site inside /config/nginx/site-confs from "default" to "default.conf".
In my specific use, I have a script that substituted the default file with my dedicated configuration used for just testing.
I will be onest, I like this choise, but please, this should have been called version 1.20.3!
Instead the version 1.20.2 was overwritten, making debugging this issue very very difficult.

Steps to Reproduce

I do not know how to reproduce it, because I do not know were the old version 1.20.2 is now (if it still exist)

Environment

OS: Debian 11
CPU architecture: x86_64/
How docker service was installed:

from official repo https://download.docker.com/linux/ubuntu

Command used to create docker container (run/create/compose/screenshot)

FROM linuxserver/nginx:1.20.2

Docker logs

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service 00-legacy: starting
s6-rc: info: service 00-legacy successfully started
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/01-envfile
cont-init: info: /etc/cont-init.d/01-envfile exited 0
cont-init: info: running /etc/cont-init.d/01-migrations
[migrations] started
[migrations] 01-nginx-site-confs-default: executing...
[migrations] 01-nginx-site-confs-default: succeeded
[migrations] done
cont-init: info: /etc/cont-init.d/01-migrations exited 0
cont-init: info: running /etc/cont-init.d/02-tamper-check
cont-init: info: /etc/cont-init.d/02-tamper-check exited 0
cont-init: info: running /etc/cont-init.d/10-adduser

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/


Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

cont-init: info: /etc/cont-init.d/10-adduser exited 0
cont-init: info: running /etc/cont-init.d/11-folders
cont-init: info: /etc/cont-init.d/11-folders exited 0
cont-init: info: running /etc/cont-init.d/12-samples
cont-init: info: /etc/cont-init.d/12-samples exited 0
cont-init: info: running /etc/cont-init.d/13-nginx
Setting resolver to  127.0.0.11
Setting worker_processes to 4
cont-init: info: /etc/cont-init.d/13-nginx exited 0
cont-init: info: running /etc/cont-init.d/14-php
cont-init: info: /etc/cont-init.d/14-php exited 0
cont-init: info: running /etc/cont-init.d/15-keygen
generating self-signed keys in /config/keys, you can replace these with your own keys if required
Generating a RSA private key
............+++++
...+++++
writing new private key to '/config/keys/cert.key'
-----
cont-init: info: /etc/cont-init.d/15-keygen exited 0
cont-init: info: running /etc/cont-init.d/20-permissions
cont-init: info: /etc/cont-init.d/20-permissions exited 0
cont-init: info: running /etc/cont-init.d/70-outdated
cont-init: info: /etc/cont-init.d/70-outdated exited 0
cont-init: info: running /etc/cont-init.d/85-version-checks
cont-init: info: /etc/cont-init.d/85-version-checks exited 0
cont-init: info: running /etc/cont-init.d/90-custom-folders
cont-init: info: /etc/cont-init.d/90-custom-folders exited 0
cont-init: info: running /etc/cont-init.d/99-custom-files
[custom-init] files found in /config/custom-cont-init.d executing
[custom-init] nginx_runscript.sh: executing...
**** LUCENELLETENEBRE MOD INSTALLATION ****
rm: cannot remove '/config/nginx/site-confs/default': No such file or directory
[custom-init] nginx_runscript.sh: exited 0
cont-init: info: /etc/cont-init.d/99-custom-files exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-mods: starting
s6-rc: info: service init-mods successfully started
s6-rc: info: service init-mods-package-install: starting
s6-rc: info: service init-mods-package-install successfully started
s6-rc: info: service init-mods-end: starting
s6-rc: info: service init-mods-end successfully started
s6-rc: info: service init-services: starting
s6-rc: info: service init-services successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun cron (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
services-up: info: copying legacy longrun php-fpm (no readiness notification)
s6-rc: info: service legacy-services successfully started
s6-rc: info: service 99-ci-service-check: starting
[ls.io-init] done.
s6-rc: info: service 99-ci-service-check successfully started

[BUG] Nginx won't Reverse Proxy Gitea Container Registry

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Nginx won't Reverse Proxy Gitea Container Registry, but the web UI is working fine.

proxy-gitea.conf:

server {
    
    listen 80;
    
    set $upstream_app gitea; #container name
    set $upstream_port 3000; #container internal port
    set $upstream_proto http;

    server_name gitea.*;

    client_max_body_size 0;


    location / {

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }


}

proxy.conf:

## Version 2022/09/02 - Changelog: https://github.com/linuxserver/docker-mods/blob/nginx-proxy-confs/root/defaults/nginx/proxy.conf.sample

# Timeout if the real server is dead
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;

# Proxy Connection Settings
proxy_buffers 32 4k;
proxy_connect_timeout 240;
proxy_headers_hash_bucket_size 128;
proxy_headers_hash_max_size 1024;
proxy_http_version 1.1;
proxy_read_timeout 240;
proxy_redirect  http://  $scheme://;
proxy_send_timeout 240;

# Proxy Cache and Cookie Settings
proxy_cache_bypass $cookie_session;
#proxy_cookie_path / "/; Secure"; # enable at your own risk, may break certain apps
proxy_no_cache $cookie_session;

# Proxy Header Settings
proxy_set_header Connection $connection_upgrade;
proxy_set_header Early-Data $ssl_early_data;
proxy_set_header Host $host;
proxy_set_header Proxy "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Real-IP $remote_addr;

When I run:

docker push gitea.hs.mm/mbesar/nginx:latest

I got:

The push refers to repository [gitea.hs.mm/mbesar/nginx]
f33a90137499: Layer already exists 
41ec0442b359: Layer already exists 
dddbf7bffd18: Layer already exists 
538f44c80ebb: Layer already exists 
d3d7516f442d: Layer already exists 
670b0bb39f97: Layer already exists 
e447796ac3e0: Layer already exists 
error parsing HTTP 405 response body: invalid character '<' looking for beginning of value: "<html>\r\n<head><title>405 Not Allowed</title></head>\r\n<body>\r\n<center><h1>405 Not Allowed</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"

and in access.log:

192.168.100.51 - - [18/Apr/2023:16:26:13 +0200] "GET /v2/ HTTP/1.1" 200 988 "-" "docker/23.0.3 go/go1.19.7 git-commit/59118bf kernel/5.10.0-21-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/23.0.3 \x5C(linux\x5C))"
192.168.100.51 - - [18/Apr/2023:16:26:13 +0200] "HEAD /v2/mbesar/nginx/blobs/sha256:513fff0d181b03f0d70ef63cf3872e4bd27d6f99fc934f99ab4cd8b662b8e7d9 HTTP/1.1" 200 0 "-" "docker/23.0.3 go/go1.19.7 git-commit/59118bf kernel/5.10.0-21-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/23.0.3 \x5C(linux\x5C))"
192.168.100.51 - - [18/Apr/2023:16:26:13 +0200] "HEAD /v2/mbesar/nginx/blobs/sha256:c91ac784c9eff9147894e8b7e2b00e4076a5bf250bcf1be813f0b8aabd8ff27b HTTP/1.1" 200 0 "-" "docker/23.0.3 go/go1.19.7 git-commit/59118bf kernel/5.10.0-21-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/23.0.3 \x5C(linux\x5C))"
192.168.100.51 - - [18/Apr/2023:16:26:13 +0200] "HEAD /v2/mbesar/nginx/blobs/sha256:9d5244c898c055f9f6d9ad9a486f5fd76b21b162de5ede879050dec2863020d5 HTTP/1.1" 200 0 "-" "docker/23.0.3 go/go1.19.7 git-commit/59118bf kernel/5.10.0-21-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/23.0.3 \x5C(linux\x5C))"
192.168.100.51 - - [18/Apr/2023:16:26:13 +0200] "HEAD /v2/mbesar/nginx/blobs/sha256:247d19ac067e07fa4fa848c0d58c71640c5bbe99d48027ba994ac9cc0e2fe279 HTTP/1.1" 200 0 "-" "docker/23.0.3 go/go1.19.7 git-commit/59118bf kernel/5.10.0-21-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/23.0.3 \x5C(linux\x5C))"
192.168.100.51 - - [18/Apr/2023:16:26:13 +0200] "HEAD /v2/mbesar/nginx/blobs/sha256:b1a08d3d4d676e53f37784b69e659d309a86e9342ea3845595c7424b982cc77c HTTP/1.1" 200 0 "-" "docker/23.0.3 go/go1.19.7 git-commit/59118bf kernel/5.10.0-21-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/23.0.3 \x5C(linux\x5C))"
192.168.100.51 - - [18/Apr/2023:16:26:13 +0200] "HEAD /v2/mbesar/nginx/blobs/sha256:08dfcae80dd98ee60617c45f3ce7fd08cae0b7fa05b47086ff64c2c80ccb7e7b HTTP/1.1" 200 0 "-" "docker/23.0.3 go/go1.19.7 git-commit/59118bf kernel/5.10.0-21-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/23.0.3 \x5C(linux\x5C))"
192.168.100.51 - - [18/Apr/2023:16:26:13 +0200] "HEAD /v2/mbesar/nginx/blobs/sha256:d2e3055e06573ab92f13c5e10afa9c4160d94a4808ce1b670b090b9a0d4522fa HTTP/1.1" 200 0 "-" "docker/23.0.3 go/go1.19.7 git-commit/59118bf kernel/5.10.0-21-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/23.0.3 \x5C(linux\x5C))"
192.168.100.51 - - [18/Apr/2023:16:26:13 +0200] "HEAD /v2/mbesar/nginx/blobs/sha256:687581dd42e57f75df00819389f8f685db1d388f597081b5e982fb897537831d HTTP/1.1" 200 0 "-" "docker/23.0.3 go/go1.19.7 git-commit/59118bf kernel/5.10.0-21-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/23.0.3 \x5C(linux\x5C))"
192.168.100.51 - - [18/Apr/2023:16:26:13 +0200] "PUT /v2/mbesar/nginx/manifests/latest HTTP/1.1" 405 150 "-" "docker/23.0.3 go/go1.19.7 git-commit/59118bf kernel/5.10.0-21-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/23.0.3 \x5C(linux\x5C))"

Expected Behavior

It should Proxy Gitea Container Registry.

Steps To Reproduce

Run the container and add the default proxy configs.

Environment

- OS: Debian 11
- How docker service was installed: distro's packagemanager

CPU architecture

x86-64

Docker creation

version: "3.9"

networks:
  hs:
    driver: bridge
    ipam:
     config:
       - subnet: 172.14.4.0/24

services:

  nginx-proxy:
    image: lscr.io/linuxserver/nginx:latest
    container_name: nginx-proxy
    networks:
      - hs
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Africa/Cairo
    volumes:
      - /mnt/srv/docker/cont/nginx-proxy:/config
    ports:
      - 80:80 # Proxy
      - 443:443
    restart: always

  gitea:
    image: gitea/gitea:1.19
    container_name: gitea
    networks:
      - hs
    environment:
      - USER_UID=1000
      - USER_GID=1000
    volumes:
      - /mnt/srv/docker/cont/gitea/data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3001:3000"
      - "2222:22"
    restart: always

Container logs

nginx-proxy  | [migrations] started
nginx-proxy  | [migrations] 01-nginx-site-confs-default: skipped
nginx-proxy  | [migrations] done
nginx-proxy  | usermod: no changes
nginx-proxy  | ───────────────────────────────────────
nginx-proxy  | 
nginx-proxy  |       ██╗     ███████╗██╗ ██████╗ 
nginx-proxy  |       ██║     ██╔════╝██║██╔═══██╗
nginx-proxy  |       ██║     ███████╗██║██║   ██║
nginx-proxy  |       ██║     ╚════██║██║██║   ██║
nginx-proxy  |       ███████╗███████║██║╚██████╔╝
nginx-proxy  |       ╚══════╝╚══════╝╚═╝ ╚═════╝ 
nginx-proxy  | 
nginx-proxy  |    Brought to you by linuxserver.io
nginx-proxy  | ───────────────────────────────────────
nginx-proxy  | 
nginx-proxy  | To support LSIO projects visit:
nginx-proxy  | https://www.linuxserver.io/donate/
nginx-proxy  | 
nginx-proxy  | ───────────────────────────────────────
nginx-proxy  | GID/UID
nginx-proxy  | ───────────────────────────────────────
nginx-proxy  | 
nginx-proxy  | User UID:    1000
nginx-proxy  | User GID:    1000
nginx-proxy  | ───────────────────────────────────────
nginx-proxy  | 
nginx-proxy  | using keys found in /config/keys
nginx-proxy  | [custom-init] No custom files found, skipping...
nginx-proxy  | [ls.io-init] done.

symlink new config path to make "nginx -s/-t" work again.

hi, nginx in this container is run with non-default location of the config, i.e:
/usr/sbin/nginx -c /config/nginx/nginx.conf

therefore things like docker exec <your nginx> nginx -t don't work. I suggest to do the following:

cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.back
rm /etc/nginx/nginx.conf
ln -s /config/nginx/nginx.conf /etc/nginx/nginx.conf

This way one would be able to reload nginx engine w/o reloading the whole container.

[BUG] https support

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

the server does not work well with https enabled, I get an error in the browser ( too many redirects)

i have to add support in WordPress for it to work, but https should be on the server level

I have to add this code in php for https to work

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
	$_SERVER['HTTPS'] = '1';
}

the way I add apps in my server is through the caprover interface

Screenshot 2024-05-06 202639

Expected Behavior

https support in the browser

Steps To Reproduce

install in docker, enable https with lets Encrypt running on a nginx server

Environment

- OS: debian 12
- How docker service was installed: followed docs https://docs.docker.com/engine/install/debian/

CPU architecture

x86-64

Docker creation

see above for screenshot

Container logs

2024-05-07T01:41:30.974150345Z [migrations] started
2024-05-07T01:41:30.982671640Z [migrations] 01-nginx-site-confs-default: executing...
2024-05-07T01:41:30.992398828Z [migrations] 01-nginx-site-confs-default: succeeded
2024-05-07T01:41:30.992427040Z [migrations] done
2024-05-07T01:41:31.021076463Z usermod: no changes
2024-05-07T01:41:31.023192409Z ───────────────────────────────────────
2024-05-07T01:41:31.023224830Z _____ __ __ _____ _____ _____ _____
2024-05-07T01:41:31.023229379Z | | | | __|_ _| | |
2024-05-07T01:41:31.023232945Z | --| | |__ | | | | | | | | |
2024-05-07T01:41:31.023236691Z |_____|_____|_____| |_| |_____|_|_|_|
2024-05-07T01:41:31.023240479Z _____ __ __ _ __ ____
2024-05-07T01:41:31.023244085Z | __ | | | | | | \
2024-05-07T01:41:31.023247572Z | __ -| | | | |__| | |
2024-05-07T01:41:31.023251289Z |_____|_____|_|_____|____/
2024-05-07T01:41:31.023254825Z
2024-05-07T01:41:31.023258222Z Based on images from linuxserver.io
2024-05-07T01:41:31.023261779Z ───────────────────────────────────────
2024-05-07T01:41:31.023526992Z
2024-05-07T01:41:31.023540537Z To support LSIO projects visit:
2024-05-07T01:41:31.023548702Z https://www.linuxserver.io/donate/
2024-05-07T01:41:31.023553231Z
2024-05-07T01:41:31.023556828Z ───────────────────────────────────────
2024-05-07T01:41:31.023561126Z GID/UID
2024-05-07T01:41:31.023569722Z ───────────────────────────────────────
2024-05-07T01:41:31.027895600Z
2024-05-07T01:41:31.027926617Z User UID: 911
2024-05-07T01:41:31.027931046Z User GID: 911
2024-05-07T01:41:31.027934171Z ───────────────────────────────────────
2024-05-07T01:41:31.027938670Z
2024-05-07T01:41:31.109377950Z Setting resolver to 127.0.0.11
2024-05-07T01:41:31.114067455Z Setting worker_processes to 6
2024-05-07T01:41:31.135893002Z generating self-signed keys in /config/keys, you can replace these with your own keys if required
2024-05-07T01:41:31.171849109Z .+++++++++++++++++++++++++++++++++++++++*...+........+...+...+.+...+........+...+....+........+.......+..+.+.........+.....+++++++++++++++++++++++++++++++++++++++*...+.........+...+.+..+.......+......+.........+......+.....+.+.....+...+.+..............+.......+........+...+...+..........+..+...+....+...+.................+......+.+.........+............+...............+..+......+....+..+.+....................+...+............+....+...++++++
2024-05-07T01:41:31.214716565Z ...+...+.............+......+.....+................+........+.+.....+.+........+.......+.....+............+.+.....+....+......+++++++++++++++++++++++++++++++++++++++*..+..........+........+.+.....+.+..+.............+..+...+....+.........+.................+....+++++++++++++++++++++++++++++++++++++++*.........+........+.......+.....+...+......+.+...+.........+......+.........+...+..+.+..............+......+.+.....+.+...+...........+...+...+...+.+.....+......+..........+............+........+...+....+.....+..........+.....+.......+.........+..+....+...+.....+...+...+..........+.........+...+..+.+..+....+.....+.............+...+........+..........+.....+.+.....+......+.........+.+............+......+..+...+................+...+......+.....+.+..................+..+....+.....+.+........+.+..+...............+....+.........+...........+...++++++
2024-05-07T01:41:31.219335880Z -----
2024-05-07T01:41:31.305954175Z [custom-init] No custom files found, skipping...
2024-05-07T01:41:31.325204662Z [ls.io-init] done.

Upgrade to Nginx 1.19.3+

Desired Behavior

Could you upgrade to Nginx 1.19.3+?
The current version does not support the proxy_cookie_flags directive. This would help a lot when trying to proxy site that set the SameSite cookie attribute to value that are no compatible with iframe.
The version is available in Alpine.

Current Behavior

The current version only has the proxy_cookie_path which does not allow to replace an existing cookie value.

Alternatives Considered

None

ARM32... why :(

Is this a new feature request?

  • I have searched the existing issues

Wanted change

You used to support the arm32. Like me, probably a lot of people use old raspberry pi to enjoy DIY.

Why did you stop ? and more over, why did you put arm64 image in the arm32:latest version.

I think I will have to learn how to correctly build the image myself.

Reason for change

Lot of arm32 devices in the wild.

Proposed code change

No response

[FEAT] Allow me to set PUID and GUID to root.

Is this a new feature request?

  • I have searched the existing issues

Wanted change

If I set the PUID or GUID to 0, I will see the following error.
[pool www] please specify user and group other than root
add options to run php-fpm with -R options

Reason for change

I am using docker as rootless.
Inside the container, a file should be created with uid=0.
This will allow me to edit files without sudo on the host.

Proposed code change

No response

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.