Instalacija Nginx na Ubuntu 10.04

Iz projekta Ubuntu-RS Wiki
Idi na: navigacija, pretraga

nginx - ubuntu 10.04 prvo par paketa ...

  sudo aptitude install php5-cgi php5-cli php5-common php5-curl php5-gd php5-json php5-mcrypt 
  php5-sqlite php5-mysql php5-dev php5-tidy php5-xmlrpc php5-memcache php5-pspell php5-xsl
  php5-mhash php5-gd php5-snmplibmagick9-dev

pa mysql klijent i server:

  sudo aptitude install mysql-server mysql-client

prilikom instalacije mysql-a podesite lozinku, pa zatim:

  sudo aptitude install spawn-fcgi

pa onda engine-x

  sudo aptitude install nginx

zatim napraviti virtual host direktorijum

  sudo mkdir -p /home/www/public

zatim napraviti direktorijum za logove

  sudo mkdir /home/www/logs

zatim promeniti ownership nad www podacima

  sudo chown -R www-data:www-data /home/www

pa editovati /etc/nginx/sites-available/default i zamneiti postojeci sadrzaj dole navedenim:

 server {
 listen 80 default;
 server_name localhost;
 access_log /home/www/logs/localhost.access.log;
 location / {
   root /home/www/public;
   index index.html index.htm index.php;
 }
 location ~ \.php$ {
 fastcgi_pass 127.0.0.1:9000;
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME /home/www/public/$fastcgi_script_name;
 include fastcgi_params;
 }
}

zatim:

 sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default

zatim editovati /etc/init.d/php-fastcgi i ubaciti sledeci sadrzaj:

 #!/bin/bash
 BIND=127.0.0.1:9000
 USER=www-data
 PHP_FCGI_CHILDREN=5 #15
 PHP_FCGI_MAX_REQUESTS=1000
 PHP_CGI=/usr/bin/php-cgi
 PHP_CGI_NAME=`basename $PHP_CGI`
 PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin 
 PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS  $PHP_CGI -b $BIND"
 RETVAL=0
 start() {
 echo -n "Starting PHP FastCGI: "
 start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS
 RETVAL=$?
 echo "$PHP_CGI_NAME."
 }
 stop() {
 echo -n "Stopping PHP FastCGI: "
 killall -q -w -u $USER $PHP_CGI
 RETVAL=$?
 echo "$PHP_CGI_NAME."
 }
 case "$1" in
 start)
 start
 ;;
 stop)
 stop
 ;;
 restart)
 stop
 start
 ;;
 *)
 echo "Usage: php-fastcgi {start|stop|restart}"
 exit 1
 ;;
 esac
 exit $RETVAL

pa onda:

  sudo chmod +x /etc/init.d/php-fastcgi

pokrenuti nginx

  sudo /etc/init.d/nginx start

pokrenuti fastcgi

  sudo /etc/init.d/php-fastcgi start

pa:

   sudo update-rc.d nginx defaults

..zatim:

  sudo update-rc.d php-fastcgi defaults

zatim napraviti index.php i ubaciti phpinfo() funkciju:

  gksudo gedit /home/www/public/index.php

index.php bi trebao izgledati ovako:

  <?php
  echo phpinfo();
  ?>

gotovo!!! sada otvorite browser i kucajte

  http://localhost


phpmyadmin & nginx

Prvo instalirati phpmyadmin

  sudo aptitude phpmyadmin

zatim editovati /etc/nginx/sites-available/phpmyadmin i ubaciti dole navedeni sadrzaj:

  gksudo gedit /etc/nginx/sites-available/phpmyadmin

sadrzaj:

  server{
    listen 80;
    server_name phpmyadmin;
    access_log /var/log/phpmyadmin.access_log;
    error_log /var/log/phpmyadmin.error_log;
    location / {
      root /usr/share/phpmyadmin;
      index index.php;
      }
      location ~ \.php$ {
      fastcgi_pass    127.0.0.1:9000;
      fastcgi_index   index.php;
      fastcgi_param   SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;
      include         fastcgi_params;
      }
    }

...zatim linkovati:

  sudo ln -s /etc/nginx/sites-available/phpmyadmin /etc/nginx/sites-enabled/phpmyadmin

...zatim editovati /etc/hosts

  gksudo gedit /etc/hosts

i dodati u liniji gde je 127.0.0.1 i localhost - phpmyadmin, da izgleda kao dole navedeno:

  127.0.0.1	 localhost      phpmyadmin
  ....

pa restartovati nginx:

  sudo service nginx restart

phpmyadmin na vasem racunaru se nalazi na adresi:

  http://phpmyadmin

Korisnička dokumentacija
Aplikacije | Multimedija | Internet i mreže | Virtuelizacija | Saveti i trikovi | Eyecandy | Serveri | Instalacija | Hardver | Laptop | Sigurnost | Igre | Info
Lični alati
Imenski prostori
Varijante
Akcije
Navigacija
alati
Linkovi