1 / 27

COSC1300 / COSC1301 Web Servers and Web Technology

COSC1300 / COSC1301 Web Servers and Web Technology. Apache Installation Week 3. Why Apache? Why Unix?. Apache: ( http://httpd.apache.org ) Ease of installation Transparent configuration Open source (and therefore free)

kalila
Download Presentation

COSC1300 / COSC1301 Web Servers and Web Technology

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COSC1300 / COSC1301 Web Servers and Web Technology Apache Installation Week 3

  2. Why Apache? Why Unix? • Apache: (http://httpd.apache.org) • Ease of installation • Transparent configuration • Open source (and therefore free) • Popular (http://news.netcraft.com/archives/web server survey.html) • Extensible (many third party modules http://modules.apache.org/) • Very good documentation (http://httpd.apache.org/docs-2.0/) RMIT Department of Computer Science and IT

  3. Other platforms, other servers • Many commercial products are just a bundled Apache. • Apache Tomcat • Other Options: • IIS • NGINX • Lighttpd • GWS RMIT Department of Computer Science and IT

  4. Apache Installation on UNIX • Common general steps (from source code): • configure: • generates a Makefile • make • compiles the code and creates a executable binary based on the Makefile settings • make install • installs executable binary to final location RMIT Department of Computer Science and IT

  5. Before you Install • While detailed instructions will be provided for the installation of your web server, you should think about what you are doing at each step. • This will help you later in the assignment, in which you are required to reinstall with a different configuration without instructions. • If you are having trouble, ask a lab assistant. RMIT Department of Computer Science and IT

  6. Preparation • Log into iWeb1.cs.rmit.edu.au • Change to your working directory cd /iweb/username *NOTE: Replace username with your own username. • You will be compiling Apache and PHP from source, so you will need the source code. Create a directory to hold the source code and copy it there mkdirsrc cd src cp /public/courses/WebServersAndWebTechnology/src/httpd-2.0.58.tar.gz . cp /public/courses/WebServersAndWebTechnology/src/php-5.1.4.tar.gz . RMIT Department of Computer Science and IT

  7. Preparation • Uncompress and unarchive the source code (often called a tarball): gtarzxvf httpd-2.0.58.tar.gz gtarzxvf php-5.1.4.tar.gz • This will create directories httpd-2.0.58 and php-5.1.4. (httpd-2.0.58 is the Apache source directory. httpd is the HTTP daemon. You will examine this in the topic “The Web”.) RMIT Department of Computer Science and IT

  8. Compiling the Apache Source Code • Before installing any software you should read any associated README and INSTALL files. • Change into the Apache directory (/iweb/username /src/httpd-2.0.58) cd /iweb/username/src/httpd-2.0.58 • and type: less README • and less INSTALL RMIT Department of Computer Science and IT

  9. Compiling the Apache Source Code • Now you should run the configure script that comes with Apache. • Your port needs to be different from the ports of other students. You should use 5 followed by the last four digits of your student number. (Example: If your student number is s3212234, then use port number 52234) ./configure --prefix=/iweb/username/apache2 \ --with-port= Your port \ --enable-so \ --with-mpm=prefork • Ask a lab assistant if you have any doubt. RMIT Department of Computer Science and IT

  10. Compiling the Apache Source Code NOW SPEND SOME TIME TRYING TO UNDERSTAND THE COMMAND YOU JUST TYPED. DISCUSS THIS WITH YOUR TUTOR. RMIT Department of Computer Science and IT

  11. Compiling the Apache Source Code • If the configure script finishes without error, you should now compile Apache and copy the binaries to the locations specified when you configured. make make install RMIT Department of Computer Science and IT

  12. Starting Apache • If your installation was successful, you should now be able to start Apache. Change to the bin directory of your Apache installation and run the apachectl script. cd /iweb/username/apache2/bin ./apachectl start • Check that you have an httpd process running by typing: ps -u username RMIT Department of Computer Science and IT

  13. Ensuring that Apache Responds • The Apache default page can now be viewed at: http://iweb1.cs.rmit.edu.au: Your port RMIT Department of Computer Science and IT

  14. Stop Apache cd /iweb/username/apache2/bin ./apachectl stop • Note: You must stop apache before you commence your php installation. RMIT Department of Computer Science and IT

  15. Apache DAEMON • httpd • http daemon • daemon • dae·mon/ˈdēmən/ • Noun:(in ancient Greek belief) A divinity or supernatural being of a nature between gods and humans. • A background process that handles requests for services such as print spooling and is dormant when not required. • Other types of daemons? RMIT Department of Computer Science and IT

  16. PHP – Apache - MySql • http://www.youtube.com/v/PemsuAfc7Jw&feature/related RMIT Department of Computer Science and IT

  17. Compiling the PHP Source Code • Change to the PHP directory (/iweb/username/src/php-5.1.4): cd /iweb/username/src/php-5.1.4 • and type less INSTALL • Again, take into consideration that you are not installing as root and that your installation will be in a non-standard directory. RMIT Department of Computer Science and IT

  18. Compiling the PHP Source Code • To configure the PHP for installation, go to your PHP source directory, and type: ./configure \ --with-apxs2=/iweb/username/apache2/bin/apxs\ --prefix=/iweb/username/php5 • If the configure script finishes without error, you should now compile PHP and copy the binaries to the locations specified when you configured as follows: make make install RMIT Department of Computer Science and IT

  19. Configuring Apache for PHP • You now need to tell Apache what to do with a PHP file as follows: • Change to the conf directory of your Apache installation. cd /iweb/username/apache2/conf • Backup the apache configuration file before you make any changes to it. cp httpd.conf httpd.conf.bak • Edit the file httpd.conf nedit httpd.conf RMIT Department of Computer Science and IT

  20. Configuring Apache for PHP • Find the line: AddType application/x-tar .tgz • Below it add the lines AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps • Note: these lines do not begin with a “#”, since lines that begin with a “#” are comments and will not be read by Apache) • Ensure that you can find the following line in your configuration file: LoadModule php5_module modules/libphp5.so RMIT Department of Computer Science and IT

  21. Test PHP • Start Apache cd /iweb/username/apache2/bin ./apachectl start • Create a .php file called information.php cd /iweb/username/apache2/htdocs nedit information.php (this opens up the nedit text editor) • In the text editor type the following php code: <?php phpinfo(); ?> • In a browser open the following link: http://iweb1.cs.rmit.edu.au: Your port /information.php RMIT Department of Computer Science and IT

  22. Cleanup Source Files cd /iweb/username/src/httpd-2.0.58 make distclean cd /iweb/username/src/php.5.1.4 make distclean cd /iweb/username/src rm -rf httpd-2.0.58 rm -rf php.5.1.4 • It is important to clean up all source files. • make distclean puts all of the files into their original state. • You must do this if you have to reinstall Apache. • By deleting the source files you are saving significant space on the hard drive. The hard drives on iweb1 and iweb2 will fill up if students do not do this! RMIT Department of Computer Science and IT

  23. Apache 2.0 versus Apache 2.2 • http://httpd.apache.org/docs-2.0/new features 2 0.html • Support for threading on Unix • Multi-platform support (MPMs) • providing native implementation for Windows and increase in performance • mod ssl bundled • http://httpd.apache.org/docs-2.2/new features 2 2.html • Apache has very recently released version 2.2. We are not using this as it does not have support for PHP yet! • Much better caching to improve web server performance. • Improved organisation of the configuration file. • Redesigned support for authentication and authorization. RMIT Department of Computer Science and IT

  24. Multi-Processing Modules • Different platforms, different needs - more information in the Web Server Performance lecture • Some MPMs for Unix: • worker (hybrid of threading/processes) • prefork (original 1.3.x process based version) • For Windows: • mpm_winnt • What MPM are we using for our apache installation? How does it work? RMIT Department of Computer Science and IT

  25. Dynamic Shared Objects • Our installation uses DSOs, http://httpd.apache.org/docs-2.0/dso.htmlThese are enable by including the --enable-so directive, to load the mod_so module, during Apache configuration. • DSOs can either be included when the server is compiled, or, as we do with the PHP module, included later by using the LoadModule directive in Apache’s httpd.conf file (actually, the process of installing PHP writes this line into the httpd.conf file automatically). • The Apache apxs program is used to build DSO modules. RMIT Department of Computer Science and IT

  26. Static Modules • The alternative is to statically compile modules which Apache is built. The simplest way to include the SSL module, mod_ssl is to compile it statically. • What are the advantages and disadvantages of DSO? • What are the advantages and disadvantages of Static Modules? RMIT Department of Computer Science and IT

  27. lighttpd, FastCGI and PHP • An emerging alternative to Apache is lighttpdhttp://lighttpd.org . As its name suggests, this server is light (uses a small amount of memory per process) and fast. According (to its own) benchmarking, it is faster than Apache. • It uses FastCGI - a significant improvement on CGI - to run PHP (and other script languages) scripts. • It’s also a great platform for rubyonrails - http://rubyonrails.org RMIT Department of Computer Science and IT

More Related