{"id":15173897,"url":"https://github.com/nazar-pc/docker-webserver","last_synced_at":"2025-10-01T10:31:47.267Z","repository":{"id":30826631,"uuid":"34383979","full_name":"nazar-pc/docker-webserver","owner":"nazar-pc","description":"WebServer (MariaDB, PHP-FPM, Nginx) composed from several separate containers linked together","archived":true,"fork":false,"pushed_at":"2018-05-24T14:37:48.000Z","size":131,"stargazers_count":290,"open_issues_count":4,"forks_count":54,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-01-15T02:36:02.024Z","etag":null,"topics":["backup","docker","docker-container","mariadb","nginx","php","restore","ssh","webserver"],"latest_commit_sha":null,"homepage":"https://registry.hub.docker.com/u/nazarpc/webserver/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nazar-pc.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-22T10:24:11.000Z","updated_at":"2024-11-03T12:31:37.000Z","dependencies_parsed_at":"2022-08-26T16:40:11.391Z","dependency_job_id":null,"html_url":"https://github.com/nazar-pc/docker-webserver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nazar-pc%2Fdocker-webserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nazar-pc%2Fdocker-webserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nazar-pc%2Fdocker-webserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nazar-pc%2Fdocker-webserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nazar-pc","download_url":"https://codeload.github.com/nazar-pc/docker-webserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234858914,"owners_count":18897834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","docker","docker-container","mariadb","nginx","php","restore","ssh","webserver"],"created_at":"2024-09-27T11:04:19.449Z","updated_at":"2025-10-01T10:31:41.986Z","avatar_url":"https://github.com/nazar-pc.png","language":"Shell","funding_links":["https://www.patreon.com/nazarpc"],"categories":[],"sub_categories":[],"readme":"# WebServer (MariaDB, PHP-FPM, Nginx) composed from several separate containers linked together\nCurrently WebServer consists of such images:\n* Data-only container (based on official `debian:jessie` image)\n* Logrotate container (based on official `debian:jessie` image)\n* MariaDB (based on official `MariaDB` image)\n* Nginx (based on official `Nginx` image)\n* PHP-FPM (based on `nazarpc/php:fpm` image, which is official image + bunch of frequently used PHP extensions)\n* SSH (based on `phusion/baseimage` image, contains pre-installed `curl`, `git`, `mc`, `wget`, `php-cli` and `composer` for your convenience)\n* PhpMyAdmin (based on `nazarpc/phpmyadmin` image, which is official php image with Apache2, where PhpMyAdmin was installed)\n* Ceph (based on upstream `ceph/daemon` image)\n* Consul (based on official `debian:jessie` image)\n* HAProxy (based on official `haproxy` image)\n* Backup container (based on official `debian:jessie` image)\n* Restore container (based on official `debian:jessie` image)\n* [nazarpc/webserver-apps](https://github.com/nazar-pc/docker-webserver-apps) for ready to use applications that plays nicely with images mentioned above\n\nIf you find this project useful, consider supporting its development on [patreon.com/nazarpc](https://www.patreon.com/nazarpc), this would help me a lot!\n\n# How to use\nThe most convenient way to use all this is [Docker Compose](https://docs.docker.com/compose/)\n\nAt first you'll need to create persistent data-only container that will store all files, databases, ssh keys and settings of all these things:\n```\ndocker run --name example.com nazarpc/webserver:data-v1\n```\n\nNOTE: `-v1` suffix here and in all other places is optional (there are also images without `-v1` suffix and they are exactly the same), however, it is possible that in future images without suffixes become completely incompatible and `-v2` suffixed images will be introduced, so you'd better be protected from upgrading to incompatible image rather than getting broken setup at some point in future (this might not happen ever, but still).\n\nThis container will start and stop immediately, that is OK.\n\nAfter this create directory for your website, it will contain `docker-compose.yml` file and potentially more files you'll need:\n```\nmkdir example.com\ncd example.com\n```\n\nNow create `docker-compose.yml` inside with following contents:\n\n```yml\nversion: '2'\nservices:\n  data:\n    image: nazarpc/webserver:data-v1\n    volumes_from:\n      - container:example.com\n  \n  logrotate:\n    image: nazarpc/webserver:logrotate-v1\n    restart: always\n    volumes_from:\n      - data\n  \n  mariadb:\n    image: nazarpc/webserver:mariadb-v1\n    restart: always\n    volumes_from:\n      - data\n  \n  nginx:\n    image: nazarpc/webserver:nginx-v1\n    links:\n      - php\n#    ports:\n#      - {ip where to bind}:{port on previous ip where to bind}:80\n    restart: always\n    volumes_from:\n      - data\n  \n  php:\n    image: nazarpc/webserver:php-fpm-v1\n    links:\n      - mariadb:mysql\n    restart: always\n    volumes_from:\n      - data\n  \n#  phpmyadmin:\n#    image: nazarpc/webserver:phpmyadmin-v1\n#    links:\n#      - mariadb:mysql\n#    restart: always\n#    ports:\n#      - {ip where to bind}:{port on previous ip where to bind}:80\n  \n  ssh:\n    image: nazarpc/webserver:ssh-v1\n    restart: always\n    volumes_from:\n      - data\n#    ports:\n#      - {ip where to bind}:{port on previous ip where to bind}:22\n#    environment:\n#      PUBLIC_KEY: '{your public SSH key}'\n```\n\nNow customize it as you like, feel free to comment-out or remove `mariadb`, `php` or `ssh` container if you have just bunch of static files, also you can uncomment `phpmyadmin` container if needed.\n\nWhen you're done with editing:\n```\ndocker-compose up -d\n```\n\nThat is it, you have whole WebServer up and running!\n\n**Also you might be interested in [advanced examples](docs/advanced.md) with load balancing and scaling across cluster.**\n\n# Upgrade\nYou can easily upgrade your WebServer to new version of software.\n\nUsing Docker Compose upgrade is very simple:\n```\ndocker-compose pull\ndocker-compose up -d\n```\nAll containers will be recreated from new images in few seconds.\n\nBackup/restore images are not present in `docker-compose.yml`, so if you're using them - pull them manually.\n\nAlternatively you can pull all images manually:\n```\ndocker pull nazarpc/webserver:data-v1\ndocker pull nazarpc/webserver:logrotate-v1\ndocker pull nazarpc/webserver:mariadb-v1\ndocker pull nazarpc/webserver:nginx-v1\ndocker pull nazarpc/webserver:php-fpm-v1\ndocker pull nazarpc/webserver:ssh-v1\ndocker pull nazarpc/webserver:backup-v1\ndocker pull nazarpc/webserver:restore-v1\n```\n\nAnd again in directory with `docker-compose.yml`:\n```\ndocker-compose up -d\n```\n\n# Backup\nTo make backup you need to only backup volumes of data-only container. The easiest way to do that is using `nazarpc/webserver:backup-v1` image:\n```\ndocker run --rm --volumes-from=example.com -v /backup-on-host:/backup --env BACKUP_FILENAME=new-backup nazarpc/webserver:backup-v1\n```\n\nThis will result in `/backup-on-host/new-backup.tar` file being created - feel free to specify other directory and other name for backup file.\n\nAll other containers are standard and doesn't contain anything important, that is why upgrade process is so simple.\n\n**NOTE: You'll likely want to stop MariaDB instance before backup (it is enough to stop master node in case of MariaDB cluster with 2+ nodes)**\n\n# Restore\nRestoration from backup is not more difficult that making backup, there is `nazarpc/webserver:restore-v1` image for that:\n```\ndocker run --rm --volumes-from=example.com -v /backup-on-host/new-backup.tar:/backup.tar nazarpc/webserver:restore-v1\n```\n\nThat is it, empty just created `example.com` container will be filled with data from backup and ready to use.\n\n# SSH\nSSH might be needed to access files from outside, especially with git.\n\nBefore you enter ssh container via SSH for the first time, you need to specify public SSH key ([how to generate SSH keys](https://help.github.com/articles/generating-ssh-keys/#step-2-generate-a-new-ssh-key)).\nThe easiest way to do this is to define `PUBLIC_KEY` environment variable in `docker-compose.yml`.\nAlternatively you can create file `/data/.ssh/authorized_keys` and put your public key contents inside.\nFor example, you can do that from Midnight Commander file manager:\n```\ndocker-compose run ssh mc\n```\n\nWhen public SSH key is added you should be able to access container as `git` user:\n```\nssh git@example.com\n```\n\n# Internal structure\nInternally all that matters is `/data` directory - it contains all necessary files (or symlinks sometimes) for your convenience - here you can see files for Nginx and MariaDB, their logs and configs, PHP-FPM's config, SSH config and SSH keys directory.\nThat is all what will be persistent, everything else outside `/data` will be lost during upgrade.\n\n# Update configuration\nIf you update some configuration - you don't need to restart everything, restart only specific service you need, for instance:\n```\ndocker-compose restart nginx\n```\n\n# License\nMIT license, see license.txt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnazar-pc%2Fdocker-webserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnazar-pc%2Fdocker-webserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnazar-pc%2Fdocker-webserver/lists"}