160 likes | 181 Views
Appendix: Installing AMP (Apache + MySQL + PHP). AMP. AMP A – Apache Web Server M – MySQL Database Server P – PHP Language Support AMP Packs in Windows AppServ Official: http://www.appservnetwork.com/ Installed Softwares: Apache, MySQL, PHP, phpMyAdmin WAMPSERVER
E N D
AMP • AMP • A – Apache Web Server • M – MySQL Database Server • P – PHP Language Support • AMP Packs in Windows • AppServ • Official: http://www.appservnetwork.com/ • Installed Softwares: Apache, MySQL, PHP, phpMyAdmin • WAMPSERVER • Official: http://www.wampserver.com/en/index.php • Installed Softwares: Apache, PHP, SQLitemanager, MySQL, Phpmyadmin
Getting AppServ • Download from official site: • Click “Download Now!” button • Select version you want. (here we choose 2.5.10)
AppServ 2.5.10 V.S. 2.6.0 • 2.5.10 • Apache 2.2.8 • MySQL 5.0.51b • PHP 5.2.6 • phpMyAdmin-2.10.3 • 2.6.0 • Apache 2.2.8 • MySQL 6.0.4-alpha • PHP 6.0.0-dev (移除register_globals,magic_quotes…etc) • phpMyAdmin-2.10.3
Installing AppServ (1) • Install • Double click the downloaded file (Appserv-win32-2.5.10.exe). • Select where to install, what to install • Setting server name, admin’s email, service port, and root password. • Unlock the Windows XP’s firewall, run up servers.
Demo (1) • Open browser, connect to: http://localhost/
Demo (2) • Using phpMyAdmin
Demo (3) • Connecting from other host
Configuring Apache • Location • The default location of apache (in AppServ) is C:\AppServ\apache2.2\conf\ • Major configuration file: httpd.conf • Two types • Global configurations • Global setting • Server specific setting • Virtual host setting • Directory Configuration • Local setting for certain directory
Configuring Apache – Global Configuration • Global setting • Timeout 300 • KeepAlive On • KeepAliveRequests 100 • StartServers 5 • Server configuration • Port 80 • ServerAdmin chwong@tphp.cs.nctu.edu.tw • ServerName tphp.cs.nctu.edu.tw • DocumentRoot "C:/AppServ/www"
Configuring Apache – Directory Configuration (1) • Configuration parameters • Options • All (turn on all options except multiview) • ExecCGI (To allow executions of AddHandler) • FollowSymLinks (access files outside this directory) • Indexs (generate file-list for browsing) (when there is no DirectoryIndex files) • MultiViews (multi-language support) • AllowOverride • All (Read .htaccess) • None (ignoring .htaccess) • Deny/Allow • IP/DN (control access to this directory) • Order • Solve collision of deny and allow rules <Directory "C:/AppServ/www"> Options Indexes FollowSymLinks MultiViews ExecCGI AllowOverride All Order allow,deny Allow from all </Directory>
Configuring Apache – Directory Configuration (2) • Virtual Directory (Directory Aliasing) • To map (alias) one sub-directory in the URL to one local directory that is not in the DocumentRoot directory. <IfModule alias_module.c> Alias /icons/ "C:/AppServ/Apache2.2/icons/" <Directory "C:/AppServ/Apache2.2/icons"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory> Alias /cpg/ "D:/wwwroot/cpg/" <Directory "D:/wwwroot"> Options Indexes FollowSymLinks MultiViews ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </IfModule>
Configuring Apache – Virtual Hosting (1) • Virtual Hosting • Providing services for more than one domain-name (or IP) in one web server. • IP-Based Virtual Hosting vs. Name-Based Virtual Hosting • IP-Base – Several IPs (or ports) • Name-Base – Singe IP, several hostnames • Example (Apache configuration) NameVirtualHost 140.113.17.215 <VirtualHost 140.113.17.215> ServerName nabsd.cs.nctu.edu.tw DocumentRoot "/www/na" </VirtualHost> <VirtualHost 140.113.17.215> ServerName tphp.cs.nctu.edu.tw DocumentRoot "/www/tphp" </VirtualHost> <VirtualHost 140.113.17.215:80> DocumentRoot /www/nabsd ServerName nabsd.cs.nctu.edu.tw </VirtualHost> <VirtualHost 140.113.17.221:80> DocumentRoot /www/tphp ServerName tphp.cs.nctu.edu.tw </VirtualHost>
Configuring Apache – Virtual Hosting (2) Q: How Name-Based Virtual Hosting works? A: It takes use of HTTP Headers. % telnet cswproxy.cs.nctu.edu.tw 80 Trying 140.113.235.111... Connected to cswproxy.cs.nctu.edu.tw. Escape character is '^]'. GET / HTTP/1.0 Host: www.cs.nctu.edu.tw HTTP/1.0 200 OK Date: Tue, 05 Jun 2007 13:50:34 GMT ………… <html> <head> <title>NCTU -- CS</title> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <meta http-equiv="refresh" content="0; URL=chinese/doc/index.html"> </head> </html> Connection closed by foreign host. % telnet cswproxy.cs.nctu.edu.tw 80 Trying 140.113.235.111... Connected to cswproxy.cs.nctu.edu.tw. Escape character is '^]'. GET / HTTP/1.0 Host: www.csie.nctu.edu.tw HTTP/1.0 200 OK Date: Tue, 05 Jun 2007 13:51:01 GMT ………… <html> <head> <title>NCTU -- CSIE</title> <meta http-equiv="refresh" content="0; URL=http://www.cs.nctu.edu.tw/"> Connection closed by foreign host.