Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Setting up ApachePHPMySQL, phpMyAdmin on UbuntuBonus Track: Adding VirtualHost
Before we start, make sure you are running as root.#sudo i or #su or #sudo bash
1. Install Apache HTTP Server– aptget install apache2– Mabilis lang ito, wag ka muna magyosi
2. Install PHP5 and Apache PHP5 module– aptget install php5 libapache2modphp5
Before we proceed to no.3.– first check if apache is running.
– open your web browser and go to http://localhost/– dapat ang makikita mo ay ito:
AYUS! IT WORKS DAW!!!
– then we have to tweak some settings of apache– #vim /etc/apache2/httpd.conf
– to prevent the error when starting apache => “apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName”
– Add this Line: ServerName localhost– ang document root ng apache ay /var/www/ as default. papalitan natin ito. gawin
nating /var/www/html/– #vim /etc/apache2/httpd.conf
– Add this Line:DocumentRoot /var/www/html
<Directory /> Options FollowSymLinks AllowOverride None </Directory>
<Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>
– Idagdag mo na rin ito, to make apache happy
DirectoryIndex index.htm index.html index.php
ScriptAlias /cgibin/ /usr/lib/cgibin/ <Directory "/usr/lib/cgibin"> AllowOverride None Options +ExecCGI MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory>
ErrorLog /var/log/apache2/error.log LogLevel warn
CustomLog /var/log/apache2/access.log combined ServerSignature On
Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow
Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory>
– tapos erase lahat ng laman ng file na 000default na nasa /etc/apache2/siteenabled/– We don't needed it anymore kasi inilagay na ntin ang laman nito sa
httpd.conf– Actually yung idinagdag natin sa httpd.conf na file starting at “ScriptAlias
/cgibin/ /usr/lib/cgibin/ ....” ay yung mga nakasulat sa file na ito.– Wag idedelete ang file na ito, erase lang ang content, gagamitin natin ito
mamaya sa Bonus track. =)– gawa tayo ng folder html sa loob ng /var/www/
– #mkdir /var/www/html– gawa tayo ng isang file sa loob ng /var/www/html as a default page
– #vim /var/www/html/index.php– Add this line
<?phpphpinfo();
?>
– Finally, Restart Apache– /etc/init.d/apache2 restart– After restarting apache, try this link: http://localhost– dapat ganito lalabas:
3. Install Database Server– sudo aptget install mysqlserver5.0– you will be promted for the root password– pwede ka pa magyosi bago mag propmt for the password.
4. Install Apache MySQL module and bundle MySQL to PHP– aptget install libapache2modauthmysql php5mysql
5. Install and Configure phpMyAdmin (Database Management)– download phpMyAdmin sa SouceForge– #tar xvfz [phpmyadmin tar file] C [DocRoot]– in this case: #tar xvfz Desktop/phpMyAdmin2.11.7rc1alllanguages/ C /var/www/html– #cd /var/www/html/– #mv phpMyAdmin2.11.7rc1alllanguages phpmyadmin– #cd phpmyadmin– #mv config.sample.inc.php config.inc.php– #vim config.inc.php– Lagayan ng value ang $cfg['blowfish_secret'] = '[whatever]';– Restart Apache: /etc/init.d/apache2 restart– Check phpmyadmin: http://localhost/phpmyadmin– username: root– password: your_password (yung inilagay mong password sa no.3)
Bonus Track: Adding Virtual Host
Port 88 ang example na gagamitin natin.
1. Edit port.conf file on /etc/apache2/● #vim /etc/apache2/port.conf● Add this Line:
Listen 88
2. Edit 000default file on /etc/apache2/siteenabled/● #vim /etc/apache2/siteenabled/000default● Add this line:
NameVirtualHost *:88
<VirtualHost *:88> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/[project folder] ServerName localhost </VirtualHost>
3. Test your work● http://localhost:88/