Joe

How to install Nginx PHP and MySQL on Ubuntu 12.04

Joe asked one year ago, 0 answers 4870 views, 0 favoured

1. Install Nginx:

  sudo add-apt-repository ppa:nginx/stable //add nginx source

  sudo apt-get update //update source
  sudo apt-get install nginx // install
 Useful Command about Nginx.
 Start Nginx:sudo /etc/init.d/nginx start;
 Browser the location:http://localhost ; if browser show "Welcome to nginx!", you have installed Nginx successfully;
 Shutdown Nginx:sudo /etc/init.d/nginx stop;
 Restart nginx:sudo /etc/init.d/nginx restart;
2. Install PHP
   sudo apt-get install php5-cli php5-cgi php5-fpm php5-mcrypt php5-mysql
  Change Nginx site config:
   sudo vim /etc/nginx/sites-available/default
   change the "index" line to:“index index.html index.htm index.php;”
 remove the following comments:
 location ~ \.php$ {
 fastcgi_pass 127.0.0.1:9000;
 fastcgi_index index.php;
 include fastcgi_params;
  }
  
  Test 
  sudo mkdir /var/www/
  sudo vim /etc/nginx/sites-available/default
  change root directory to: “root /var/www;”  
   sudo vim /var/www/test.php
  Add the following content to test.php file:
  <?php phpinfo();?>
   sudo /etc/init.d/nginx restart
http://localhost/test.php
3. Install MySQL
sudo apt-get install mysql-server

© OSTree(Open Source Tree Community) | About OSTree | Advertisement | Feedback