## Step 2 (B): NGINX Web Server + PHP5.5 For this step, you may choose either (A) Apache or (B) Nginx. ### Installation * `yum update -y` Update linux packages * `yum install -y nginx` Install NGINX webserver * `chkconfig httpd on` Setup service * `yum -y install php55 php55-fpm php55-bcmath php55-devel php55-common php55-cli php55-pecl-apc php55-pdo php55-mysql php55-xml php55-gd php55-mbstring php-pear php55-mysqlnd php55-mcrypt` Install php and the usual extensions, including FPM. ### Configuration * **Nginx Configuration** `vi /etc/nginx/nginx.conf` ``` root /var/www/html; location / { root /var/www/html; index index.php index.html index.htm; } location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name; include fastcgi_params; } ``` * **PHP-FPM Configuration** `vi /etc/php-fpm.d/www.conf` ``` listen = /var/run/php-fpm/php-fpm.sock listen.owner = nginx listen.group = nginx listen.mode = 0664 user = nginx group = nginx ``` * **PHP Configuration** `vi /etc/php.ini` ``` error_log = /var/log/php-error.log date.timezone = "UTC" ``` ### Finalization ``` usermod -a -G devgroup nginx chown -R root:devgroup /var/www/html chmod -R 775 /var/www/html chkconfig nginx on service nginx start chkconfig php-fpm on service php-fpm start ```