Skip to content

Instantly share code, notes, and snippets.

@drmmr763
Created May 29, 2018 01:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drmmr763/7a7fd4145a3597ef1bc003b17cc18fb8 to your computer and use it in GitHub Desktop.
Save drmmr763/7a7fd4145a3597ef1bc003b17cc18fb8 to your computer and use it in GitHub Desktop.
Xdebug | PHP
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /home/app/public;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
FROM ubuntu:latest
RUN apt-get update
RUN apt-get -y install software-properties-common python-software-properties
RUN apt-get -y --no-install-recommends install \
ca-certificates \
inetutils-ping \
telnet \
curl \
nano \
net-tools \
make \
git \
nginx \
zip \
unzip \
mysql-client \
curl \
htop \
wget
RUN apt-get install -y language-pack-en-base
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
RUN apt-get update
RUN apt-get -y --no-install-recommends install \
php7.2 \
php7.2-fpm \
php7.2-dev \
php7.2-mbstring \
php7.2-xml \
php7.2-zip \
php7.2-mysql \
php7.2-intl
RUN git clone https://github.com/xdebug/xdebug.git && cd xdebug && ./rebuild.sh
RUN curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar && \
cp phpcs.phar /usr/local/bin/phpcs && \
chmod +x /usr/local/bin/phpcs
COPY xdebug.ini /etc/php/7.2/cli/conf.d/xdebug.ini
COPY xdebug.ini /etc/php/7.2/fpm/conf.d/xdebug.ini
COPY default.site.nginx /etc/nginx/sites-available/default
EXPOSE 9000
CMD sh startup.sh
#!/usr/bin/env bash
service php7.2-fpm start;
nginx -g 'daemon off;'
zend_extension=xdebug.so
xdebug.remote_autostart=1
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_connect_back=0
xdebug.cli_color=1
xdebug.remote_log="/tmp/xdebug.log"
xdebug.profiler_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment