Home > Guides > Alpine Server > Setting up PHP 7 with Nginx

Setting up PHP 7 with Nginx


Install PHP 7:

apk add php7-fpm php7-mcrypt php7-soap php7-openssl php7-gmp php7-pdo_odbc php7-json php7-dom php7-pdo php7-zip php7-mysqli php7-sqlite3 php7-apcu php7-pdo_pgsql php7-bcmath php7-gd php7-odbc php7-pdo_mysql php7-pdo_sqlite php7-gettext php7-xmlreader php7-xmlrpc php7-bz2 php7-iconv php7-pdo_dblib php7-curl php7-ctype


Edit /etc/php7/php.ini:

date.timezone = Europe/Amsterdam

Start the service:

/etc/init.d/php-fpm7 start
rc-update add php-fpm7

Edit /etc/nginx/sites-available/02_localhost to add in the following within server:

server {
	location ~\.php$ {
		fastcgi_split_path_info ^(.+\.php)(.*)$;
		include fastcgi.conf;

Edit /var/www/localhost/htdocs/version.php:


Reload the Nginx configuration:

/etc/init.d/nginx reload