Skip to content

Instantly share code, notes, and snippets.

@omero
Last active January 3, 2017 18:04
Show Gist options
  • Save omero/5edc904d6f06d541f358d09076387c6b to your computer and use it in GitHub Desktop.
Save omero/5edc904d6f06d541f358d09076387c6b to your computer and use it in GitHub Desktop.
DO (ubuntu) +nginx +php7 + phpci setup

#Setup LEM environment for phpci

Initial Droplet setup (optional ufw rules)

https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04

Install Nginx (LEMP) and PHP (optional ufw rules)

https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04

#Install nginx
sudo apt-get install nginx

#Install mysql
sudo apt-get install mysql-server

#Install php and php extensions
sudo apt-get install php-fpm php-mysql php-curl php-mbstring php-gd php-dom php-simplexml

Install composer

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-14-04

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
sudo chmod +x /usr/local/bin/composer

Install PHPCI

https://www.phptesting.org/install-phpci

#Go to your www directory (on a Linux server, this is usually /var/www)

#Download PHPCI: 
composer create-project block8/phpci phpci --keep-vcs --no-dev

#Go to the newly created PHPCI directory, and install Composer dependencies: 
cd phpci && composer install

#Run the PHPCI installer: 
./console phpci:install

#Add a virtual host to your web server, pointing to the "public" directory within your new PHPCI directory.
#You'll need to set up rewrite rules to point all non-existent requests to PHPCI.

Virtual Host for phpci

server {
	listen 80;
	listen [::]:80;

	server_name php-deploy.hechoendrupal.com;

	root /var/www/html/phpci/public;
	index index.html index.php;

	location / {
                try_files $uri @phpci;
        }

        location @phpci {
                # Pass to FastCGI:
                fastcgi_pass 	  [unix:/run/php/php7.0-fpm.sock];
                fastcgi_index   index.php;
                fastcgi_buffers 256 4k;
                include         fastcgi_params;
                fastcgi_param   SCRIPT_FILENAME [/var/www/html/phpci/public/index.php];
                fastcgi_param   SCRIPT_NAME index.php;
        }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment