Metoda cea mai buna de a instala un web server pe linux

Configurare noua (How To)

Situatie

Se doreste instalarea unui webserver pe un linux debian

Solutie

Pasi de urmat

Se ruleaza comanda “sudo apt-get update” pentru a face un update al “repositories”.
Apoi se ruleaza comanda “sudo apt-get install apache2” pentru a instala serverul Apache.

Se instaleaza MySQL.

Se ruleaza comanda “sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql”

In timpul instalarii MySQL o sa fie necesara setarea unei parole de root.

Pentru a activa MySQL se ruleaza comanda “sudo mysql_install_db”

Vor aparea urmatoarele intrebari la care trebuie sa raspundeti cu Yes sau No:

Prima optiune este pentru stergerea utilizatorilor anonimi.

A doua optiune este pentru dezactivarea conexiunii remote pentru userul root.

A treia optiune este pentru stergerea bazei de date “test” si accesul la ea.

A patra optiune este pentru reincarcarea in MySQL a privilegiilor.

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y                                            
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

Instalarea PHP

Se ruleaza comanda “sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt”

Daca aveti nevoie de un modul anume pentru PHP puteti rula comanda “apt-cache search php5-” pentru a vedea ce module sunt disponibile.

Dupa ce ati gasit modulul care va trebuie, rulati comanda “sudo apt-get install name of the module”

Testarea

Veti crea un fisier cu comanda “sudo nano /var/www/info.php” in care veti scrie ”

<?php
phpinfo();
?>

Salvati fisierul si restartati serverul apache cu comanda “sudo service apache2 restart”

Deschideti un browser, tastati adresa ip a calculatorului pe care ati instalat serverul si pagina info.php ca in exemplul de mai jos:

http://123.456.789.012/info.php

Tip solutie

Permanent

Voteaza

(15 din 34 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?