First, install the Xdebug package from the testing repository.
$ apk add php7-xdebug --repository http://dl-3.alpinelinux.org/alpine/edge/testing/
Now edit the /etc/php7/php.ini file and add the following to the end of it:
zend_extension=/usr/lib/php7/modules/xdebug.so
xdebug.coverage_enable=0
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_log=/tmp/xdebug.log
xdebug.remote_autostart=true
With everything in place, we're ready to restart the server.
$ nginx -s reload
$ /etc/init.d/php-fpm restart
At this point, in PHPStorm, click "Run > Start Listening for PHP Debug Connections", and then "Run > Break at first line in PHP Scripts".
Now reload the site in the browser, making sure to use the port that goes directly to the server, which is sometimes :8080 instead of :80, and you should see the debugger fire up.
Package
php7-xdebugis going to be replaced byphp7-pecl-xdebugin release Alpine 3.9.0 : https://bugs.alpinelinux.org/issues/9277.However, this change is reflected in package search : https://pkgs.alpinelinux.org/packages?name=php7-pecl-xdebug&branch=edge.
Installing
php7-pecl-xdebugwill result in missing package. Package name in the repo is stillphp7-xdebug.