Coder Social home page Coder Social logo

docker-nginx-php's Introduction

Docker: Ubuntu, Nginx and PHP Stack

This is the basis for LEMP stack (minus MySQL). This is based on phusion/baseimage-docker base Ubuntu image, which takes care of system issues which Docker's base Ubuntu image does not take care of, such as watching processes, logrotate, ssh server, cron and syslog-ng.

You can build this yourself after cloning the project (assuming you have Docker installed).

cd /path/to/repo/docker-nginx-php
docker build -t webapp . # Build a Docker image named "webapp" from this location "."
# wait for it to build...

# Run the docker container
docker run -v /path/to/local/web/files:/var/www:rw -p 80:80 -d webapp /sbin/my_init --enable-insecure-key

This will bind local port 80 to the container's port 80. This means you should be able to go to "localhost" in your browser (or the IP address of your virtual machine oh which Docker is running) and see your web application files.

  • docker run - starts a new docker container
  • -v /path/to/local/web/files:/var/www:rw - Bind a local directory to a directory in the container for file sharing. rw makes it "read-write", so the container can write to the directory.
  • -p 80:80 - Binds the local port 80 to the container's port 80, so local web requests are handled by the docker.
  • -d webapp - Use the image tagged "webapp"
  • /sbin/my_init - Run the init scripts used to kick off long-running processes and other bootstrapping, as per phusion/baseimage-docker
  • --enable-insecure-key - Enable a generated SSL key so you can SSH into the container, again as per phusion/baseimage-docker. Generate your own SSH key for production use.
  • If you use this with fideloper/docker-mysql, then link this container with MySQL's (after running the MySQL container first) via -link mysql:db

docker-nginx-php's People

Contributors

aranw avatar betobe avatar blackthornyugen avatar fideloper avatar m00dy 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  avatar  avatar  avatar  avatar  avatar  avatar

docker-nginx-php's Issues

PHP files not getting executed

I cant seem to get a php file to run.

I ran the container , with a simple php file that does a die changes the path to my file which was sitting on my host machine. Is there anything else I need to be doing ?

How to run a virtual host

How do I run a virtual host like test.dev. I made a test.dev file changing the folder to /var/www/test.dev and added the test.dev in my hosts file and to the dockerfile with ADD. But I cannot run it. How do I do this?

Add x debug

how do I add X-Debug to this docker image?

problem on .php file

Currently, It is not working as expected.

Nginx can serve html files but not .php files.

Docker version 1.4.1, build 5bc2ff8

Problems with boot2docker / sendfile

Hi,

I wasted 3 hours on this, so maybe this helps someone:

Nginx was serving stale / old files, only solveable by restarting the boot2docker vm. I blamed nginx, apparently wrongly so.

After a lot of different approaches, I stumbled upon https://jeremyfelt.com/2013/01/08/clear-nginx-cache-in-vagrant/ . I changed the nginx.conf as such:

docker run --rm -t -i fbaaken/nginx-php /sbin/my_init -- bash -l
root@0e96ebfdb15b:/# vi /etc/nginx/nginx.conf
(Edited to sendfile off;)
(Committed container state to new image so to not lose changes)
(Ran from the new image from then on)

Hope this helps someone. I will keep the issue open, maybe there is a way to make this easier to configure when running the container so we can sue the same on in dev / prod environments when it's not running on a Virtualbox image (sendfile should be on in this case).

Best,

Felix

Typo

Small typo in docker built -t webapp . - should be docker build -t web app ..

Having issue on adding ppa:ondrej/php5

I got this error when building this on add-apt-repository -y ppa:ondrej/php5. Here's the error:

gpg: keyring `/tmp/tmp07lyg_wt/secring.gpg' created
gpg: keyring `/tmp/tmp07lyg_wt/pubring.gpg' created
gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp07lyg_wt/trustdb.gpg: trustdb created
gpg: key E5267A6C: public key "Launchpad PPA for Ond\xc5\x99ej Sur�" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 687, in addkey_func
    func(**kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 370, in add_key
    return apsk.add_ppa_signing_key()
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 261, in add_ppa_signing_key
    tmp_export_keyring, signing_key_fingerprint, tmp_keyring_dir):
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 210, in _verify_fingerprint
    got_fingerprints = self._get_fingerprints(keyring, keyring_dir)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 202, in _get_fingerprints
    output = subprocess.check_output(cmd, universal_newlines=True)
  File "/usr/lib/python3.4/subprocess.py", line 605, in check_output
    output, unused_err = process.communicate(inputdata, timeout=timeout)
  File "/usr/lib/python3.4/subprocess.py", line 936, in communicate
    stdout = _eintr_retry_call(self.stdout.read)
  File "/usr/lib/python3.4/subprocess.py", line 487, in _eintr_retry_call
    return func(*args)
  File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 92: ordinal not in range(128)

Is this issue came from phusion/baseimage?

Publish in Docker Hub?

Hey,

Would it be possible for you to publish this repo in Docker Hub as an Automated Build Repository? That way one can do a simple docker pull fideloper/docker-nginx-php rather than having to clone the repo and build it? Also one can then use the repo as a FROM in their own Dockerfiles.

You can point the Docker Hub repo at this GitHub repo so you don't need to update it every time you make a commit (similar to what I've done with my docker-couchpotato repository).

Thanks!

Dylan

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.