12

Click here to load reader

Speed up your development environment PHP + Nginx + Fedora + PG

Embed Size (px)

Citation preview

Page 1: Speed up your development environment PHP + Nginx + Fedora + PG

Speed up your development environment

PHP + Nginx + Fedora + PG

Marcus SáDeveloper | Woompa

[email protected]@sa_vini

Page 2: Speed up your development environment PHP + Nginx + Fedora + PG

Scenario

● Ruby developer● PHP is the customer's requirement

● Development environment not installed● Very tight deadline (O RLY?)

Page 3: Speed up your development environment PHP + Nginx + Fedora + PG

Decisions taken

● Avoid complexity*● Use PHP to develop

● Install environment: PHP, PostgreSQL, Nginx● Using a CMS (Joomla will take care)

Page 4: Speed up your development environment PHP + Nginx + Fedora + PG

Avoid complexity*

● Develop the minimum possible● Use modules and components already made

● Focus on the important things

Page 5: Speed up your development environment PHP + Nginx + Fedora + PG

Installing environment

● Update your system● Install Nginx● Install PHP

● Install PostgreSQL● Configure Nginx

Page 6: Speed up your development environment PHP + Nginx + Fedora + PG

Update your system

$ yum update

Page 7: Speed up your development environment PHP + Nginx + Fedora + PG

Install NginxInstalling nginx$ yum install nginxSet it to start on boot$ chkconfig nginx onStart right now!$ service nginx start

sudo if needed

Page 8: Speed up your development environment PHP + Nginx + Fedora + PG

Configure Nginxserver {

server_name www.example.com example.com;root /srv/www/www.example.com/public_html;

location / { index index.html index.htm;}

location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:53217; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;}

}

Page 9: Speed up your development environment PHP + Nginx + Fedora + PG

Install PHPinstall packages required for PHP-FastCGI$ yum install php spawn-fcgiSet it to start on boot$ chkconfig spawn-fcgi onStart right now!$ service spawn-fcgi start

sudo if needed

Page 10: Speed up your development environment PHP + Nginx + Fedora + PG

Configure PHPediting spawn-fcgi

$ nano /etc/sysconfig/spawn-fcgi

FASTCGI_USER=nginxFASTCGI_GROUP=nginxSOCKET=/var/run/spawn-fcgi.sockPIDFILE=/var/run/spawn-fcgi.pidPHP5_SOCKET=/var/run/php-fcgi.sockCHILDREN=6PHP5=/usr/bin/php-cgiMODE=0600OPTIONS="-s $PHP5_SOCKET -S -M $MODE -P $PIDFILE -C $CHILDREN -u $FASTCGI_USER -g $FASTCGI_GROUP -f $PHP5"

sudo if needed

Page 11: Speed up your development environment PHP + Nginx + Fedora + PG

Install PostgreSQL

Download it

http://www.enterprisedb.com/Make executable$ chmod +x postgre_file.binExecute and install

$ ./postgre_file.binsudo if needed

Page 12: Speed up your development environment PHP + Nginx + Fedora + PG

That's all folks

Thanks!