Full Code of fideloper/docker-nginx-php for AI

master 974461dc3396 cached
7 files
4.7 KB
1.6k tokens
1 requests
Download .txt
Repository: fideloper/docker-nginx-php
Branch: master
Commit: 974461dc3396
Files: 7
Total size: 4.7 KB

Directory structure:
gitextract_64ads6vk/

├── .gitignore
├── Dockerfile
├── build/
│   ├── default
│   ├── nginx.sh
│   └── phpfpm.sh
├── readme.md
└── www/
    └── .gitignore

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
.DS_Store
._*
.vagrant


================================================
FILE: Dockerfile
================================================
FROM phusion/baseimage:0.9.15

# Ensure UTF-8
RUN locale-gen en_US.UTF-8
ENV LANG       en_US.UTF-8
ENV LC_ALL     en_US.UTF-8

ENV HOME /root

RUN /etc/my_init.d/00_regen_ssh_host_keys.sh

CMD ["/sbin/my_init"]

# Nginx-PHP Installation
RUN apt-get update
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y vim curl wget build-essential python-software-properties
RUN add-apt-repository -y ppa:ondrej/php5
RUN add-apt-repository -y ppa:nginx/stable
RUN apt-get update
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y --force-yes php5-cli php5-fpm php5-mysql php5-pgsql php5-sqlite php5-curl\
		       php5-gd php5-mcrypt php5-intl php5-imap php5-tidy

RUN sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php5/fpm/php.ini
RUN sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php5/cli/php.ini

RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y nginx

RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf
RUN sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php5/fpm/php.ini
 
RUN mkdir -p        /var/www
ADD build/default   /etc/nginx/sites-available/default
RUN mkdir           /etc/service/nginx
ADD build/nginx.sh  /etc/service/nginx/run
RUN chmod +x        /etc/service/nginx/run
RUN mkdir           /etc/service/phpfpm
ADD build/phpfpm.sh /etc/service/phpfpm/run
RUN chmod +x        /etc/service/phpfpm/run

EXPOSE 80
# End Nginx-PHP

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


================================================
FILE: build/default
================================================
server {
    listen  80;

    root /var/www;
    index index.html index.htm index.php;

    # Make site accessible from http://set-ip-address.xip.io
    server_name localhost;

    access_log /var/log/nginx/localhost.com-access.log;
    error_log  /var/log/nginx/localhost.com-error.log error;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.html /index.php?$query_string;
    }

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    # pass the PHP scripts to php5-fpm
    # Note: \.php$ is susceptible to file upload attacks
    # Consider using: "location ~ ^/(index|app|app_dev|config)\.php(/|$) {"
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # With php5-fpm:
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        include fastcgi.conf;
        fastcgi_param LARA_ENV local; # Environment variable for Laravel
        fastcgi_param HTTPS off;
    }

    # Deny .htaccess file access
    location ~ /\.ht {
        deny all;
    }
}


================================================
FILE: build/nginx.sh
================================================
#!/usr/bin/env bash

nginx


================================================
FILE: build/phpfpm.sh
================================================
#!/usr/bin/env bash

php5-fpm -c /etc/php5/fpm


================================================
FILE: readme.md
================================================
# Docker: Ubuntu, Nginx and PHP Stack

This is the basis for LEMP stack (minus MySQL). This is based on [phusion/baseimage-docker](https://github.com/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).

```bash
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](https://github.com/phusion/baseimage-docker)
* `--enable-insecure-key` - Enable a generated SSL key so you can SSH into the container, again as per [phusion/baseimage-docker](https://github.com/phusion/baseimage-docker). Generate your own SSH key for production use.
* If you use this with [fideloper/docker-mysql](https://github.com/fideloper/docker-mysql), then [link this container](http://docs.docker.io/en/latest/use/working_with_links_names/) with MySQL's (after running the MySQL container first) via `-link mysql:db`


================================================
FILE: www/.gitignore
================================================
*
!.gitignore
Download .txt
gitextract_64ads6vk/

├── .gitignore
├── Dockerfile
├── build/
│   ├── default
│   ├── nginx.sh
│   └── phpfpm.sh
├── readme.md
└── www/
    └── .gitignore
Condensed preview — 7 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (5K chars).
[
  {
    "path": ".gitignore",
    "chars": 23,
    "preview": ".DS_Store\n._*\n.vagrant\n"
  },
  {
    "path": "Dockerfile",
    "chars": 1525,
    "preview": "FROM phusion/baseimage:0.9.15\n\n# Ensure UTF-8\nRUN locale-gen en_US.UTF-8\nENV LANG       en_US.UTF-8\nENV LC_ALL     en_US"
  },
  {
    "path": "build/default",
    "chars": 1184,
    "preview": "server {\n    listen  80;\n\n    root /var/www;\n    index index.html index.htm index.php;\n\n    # Make site accessible from "
  },
  {
    "path": "build/nginx.sh",
    "chars": 27,
    "preview": "#!/usr/bin/env bash\n\nnginx\n"
  },
  {
    "path": "build/phpfpm.sh",
    "chars": 47,
    "preview": "#!/usr/bin/env bash\n\nphp5-fpm -c /etc/php5/fpm\n"
  },
  {
    "path": "readme.md",
    "chars": 2041,
    "preview": "# Docker: Ubuntu, Nginx and PHP Stack\n\nThis is the basis for LEMP stack (minus MySQL). This is based on [phusion/baseima"
  },
  {
    "path": "www/.gitignore",
    "chars": 14,
    "preview": "*\n!.gitignore\n"
  }
]

About this extraction

This page contains the full source code of the fideloper/docker-nginx-php GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 7 files (4.7 KB), approximately 1.6k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!