sudo apt-get update
sudo apt-get install mysql-server php5-mysqlDuring the installation, MySQL will ask you to set a root password. If you miss the chance to set the password while the program is installing, it is very easy to set the password later from within the MySQL shell.
sudo mysql_install_dbFinish up by running the MySQL set up script:
sudo /usr/bin/mysql_secure_installationThe prompt will ask you for your current root password. Type it in.
Enter current password for root (enter for none): OK, successfully used password, moving on...The prompt will ask if you want to change the root password. Go ahead and choose N for this option, as the root password should aready be set; however, for the rest of the questions you can simply reply Y to all-- unless there is a reason for you to do otherwise.
sudo apt-get install nginx
sudo service nginx startNow if you point your browser to your IP address, it should confirm that nginx was successfully installed on your cloud server.
ifconfig eth0 | grep inet | awk '{ print $2 }'
sudo nano /etc/nginx/sites-available/default
[...] server { listen 80; root /usr/share/nginx/www; index index.php index.html index.htm; server_name example.com; location / { try_files $uri $uri/ /index.html; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } [...]
sudo apt-get install php5-fpm
sudo nano /etc/php5/fpm/php.iniFind the line cgi.fix_pathinfo=1 and change the 1 to 0.
cgi.fix_pathinfo=0If this number is kept as 1, the php interpreter will do its best to process the file that is as near to the requested file as possible. This is a possible security risk. If this number is set to 0, conversely, the interpreter will only process the exact file path— a much safer alternative. Save and Exit.
sudo nano /etc/php5/fpm/pool.d/www.confFind the line, listen = 127.0.0.1:9000, and change the 127.0.0.1:9000 to /var/run/php5-fpm.sock.
listen = /var/run/php5-fpm.sockSave and Exit.
sudo service php5-fpm restart
sudo nano /usr/share/nginx/www/info.phpAdd in the following line:
<?php phpinfo(); ?>Then Save and Exit.
sudo service nginx restartYou can see the nginx and php-fpm configuration details by visiting http://youripaddress/info.php
Article ID: 194
Created On: Fri, Dec 27, 2013 at 12:07 AM
Last Updated On: Sun, Jan 5, 2014 at 8:20 PM
Authored by: ASPHostServer Administrator [asphostserver@gmail.com]
Online URL: http://faq.asphosthelpdesk.com/article.php?id=194