Last active
February 4, 2016 02:00
-
-
Save jbroadway/6369183 to your computer and use it in GitHub Desktop.
Dockerfile for Nginx + PHP server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:13.04 | |
MAINTAINER Johnny Broadway "[email protected]" | |
RUN apt-get update | |
RUN apt-get install -y wget git vim postfix nginx sqlite | |
RUN apt-get install -y mysql-server mysql-client | |
RUN apt-get install -y php5-cli php5-common php5-mysql php5-sqlite php5-curl php5-fpm | |
RUN wget -O /etc/nginx/sites-available/default https://gist.github.com/jbroadway/6369183/raw/682a1ed8078cc39f59c3624f460b128addff95db/nginx-default | |
RUN echo "cgi.fix_pathinfo = 0;" >> /etc/php5/fpm/php.ini | |
RUN echo "daemon off;" >> /etc/nginx/nginx.conf | |
RUN mkdir /var/www | |
EXPOSE 80 | |
CMD service php5-fpm start && nginx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root /var/www; | |
index index.php index.html; | |
# Make site accessible from http://localhost/ | |
server_name localhost; | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment