0% found this document useful (0 votes)
79 views4 pages

Week2 Lamp

The document provides instructions for installing and configuring a LAMP stack on Ubuntu 14.04. It describes installing PHP, Apache2, MySQL, and configuring virtual hosts. It includes 10 tasks that guide the user through setting up a basic LAMP environment, creating sample databases and content for two virtual hosts, configuring Apache virtual hosts, and modifying file permissions and firewall settings.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views4 pages

Week2 Lamp

The document provides instructions for installing and configuring a LAMP stack on Ubuntu 14.04. It describes installing PHP, Apache2, MySQL, and configuring virtual hosts. It includes 10 tasks that guide the user through setting up a basic LAMP environment, creating sample databases and content for two virtual hosts, configuring Apache virtual hosts, and modifying file permissions and firewall settings.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Veba2

LAMP
Cilj

Instalacija PHP, Apache2, MySql


Upoznavanje sa virtuelnim hostovima

1. LAMP

LAMP je skraenica za Linux, Apache, MySQL i PHP. Instalacija:

apt-get install apache2 libapache2-mod-php5

apt-get install mysql-server php5-mysql libapache2-mod-auth-mysql

Zadatak 0: Pokrenuti Ubuntu 14.04 (\\pdc\cloud\ubuntu14.rar) pomou WMware


Player-a.

Zadatak 1: Instalirati paket phpmyadmin.

sudo apt-get install phpmyadmin

Zadatak 2: Pokrenuti test stranu apache servera.

Ifconfig
Kopirati ip adresu I uneti u browser
Zadatak 3: Da li je strana dostupna nakon izvrene komande :

sudo chmod o-r /var/www/html/index.html.

Ne
Zadatak 4: Da li je strana dostupna nakon izvrene komande:

sudo chown :www-data /var/www/html/index.html.

Da
Zadatak 5: Da li je strana dostupna nakon izvrene komande:

sudo chmod o-x /var/www.


Ne
Zadatak 6: Podesite prava pristupa tako da strana index.html bude dostupna.

sudo chmod o+x /var/www.

sudo chmod o-r /var/www/html/index.html.

Zadatak 7: Omoguiti firewall ufw. Izlistati sva pravila (iptables). Da li je mogue


pristupiti strani index.html u lokalu i iz Windows-a? Omoguiti pristup portu 80.

sudo ufw allow 80


Zadatak 8: Virtuelni hostovi:

Kreirati direktorijume primer1 i primer 2 u /var/www.

sudo mkdir /var/www/primer1


sudo mkdir /var/www/primer2

Promeniti vlasnitvo nad folderima:

sudo chown -R linux:linux /var/www/primer1


sudo chown -R linux:linux /var/www/primer2

Kreirati strancie za svakog virtuelnog hosta:

nano /var/www/primer1/index.php
nano /var/www/primer2/index.html

index.php treba da u tabeli prikae sve podatke iz tabele Student relacione baze
ispit. Bazu podataka prethodno kreirati.
ema relacione baze podataka ispit:
Student(IDStudent, Ime, Prezime, Ocena)
what you need to do is to add phpmyadmin to the apache configuration:

sudo nano /etc/apache2/apache2.conf


Add the phpmyadmin config to the file:

Include /etc/phpmyadmin/apache.conf
then restart apache:
sudo service apache2 restart

Mysql> create table student(IDStudent int not null auto_increment


primary key, Ime text, Prezime text,Ocena int);

Napraviti fajl za virtuelnog hosta i izvriti konfigurisanje:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-


available/primer1.com.conf

sudo nano /etc/apache2/sites-available/ primer1.com.conf


<VirtualHost *:80>
ServerAdmin [email protected]
ServerName primer1.com
ServerAlias www.primer1.com
DocumentRoot /var/www/primer1
</VirtualHost>

Napraviti fajl za drugog virtuelnog hosta i izvriti konfigurisanje:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-


available/primer2.com.conf

sudo nano /etc/apache2/sites-available/ primer2.com.conf


<VirtualHost *:80>
ServerAdmin [email protected]
ServerName primer2.com
ServerAlias www.primer2.com
DocumentRoot /var/www/primer2
</VirtualHost>

Omoguiti sajt
sudo a2ensite primer1.com.conf
sudo a2ensite primer2.com.conf

Ponovo pokrenuti servis apache2

sudo service apache2 restart

Zadatak 9: Napistati alternativnu komandu koja prouzrokuje isti efekat kao


komanda a2ensite.

Promeniti lokalni hosts fajl

sudo nano /etc/hosts

127.0.0.1 localhost
127.0.1.1 Ubuntu
ip_adresa primer1.com
ip_adresa primer2.com

Testirati u browser-u.

http://primer1.com
http://primer2.com

Zadatak 10: Izlistati sadraj logova access.log i error.log. Ukloniti pravo itanja
za sve korisnike (/var/www/html/index.html), i pomou komande tail-f pratiti
generisanje logova.

You might also like