P. 1
Install the Apache 2 Web Server on Fedora 13 – Linode Library

Install the Apache 2 Web Server on Fedora 13 – Linode Library

|Views: 9|Likes:
Published by Er Nishant Sinha

More info:

Published by: Er Nishant Sinha on Apr 03, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/13/2014

pdf

text

original

Install the Apache 2 Web Server on Fedora 13 – Linode Library

http://library.linode.com/web-servers/apache/installation/fedora-13

Search the Linode Library

Categories
Getting Started Beginner's Guide Linode Platform LAMP Guides LEMP Guides Application Stacks Communications Databases DNS Services Email Guides Frameworks High Availability Linux Tools Networking Security Server Monitoring Troubleshooting Using Linux Web Applications Web Servers Apache Installation Ubuntu 10.04 Ubuntu 10.10 Debian 6 Debian 5 CentOS 5 Fedora 14 Configuration PHP/CGI mod_wsgi Proxy Guides SSL Guides Troubleshooting mod_security mod_evasive Nginx Cherokee Lighttpd

Linode Library Home :: Web Servers :: Hosting Websites with Apache :: Basic Apache Installation :: Install the Apache 2 Web Server on Fedora 13

Linode Home

Install the Apache 2 Web Server on Fedora 13
Published: Friday, May 28th, 2010 by Sam Kleinman

Share

Warning This document is an older, unmaintained guide. There may be a new guide available for this software.

This tutorial explains how to install and configure the Apache web server on Fedora 13. All configuration will be done through the terminal; make sure you are logged in as root via SSH. If you have not followed the getting started guide, it is recommended that you do so prior to beginning this guide. Also note that if you're looking to install a full LAMP stack, you may want to consider using our LAMP guide for Fedora 13.

Contents
Install Apache HTTP Server Install Support for Scripting Configure Apache Configure Virtual Hosts Configuration Options Install Apache Modules Understanding .htaccess Configuration Password Protecting Directories Rewriting URLs with mod_rewrite More Information

Install Apache HTTP Server
Before beginning the installation process, ensure that you are running a complete and update version of your system. Issue the following command:
yum update

Enter the following command to install the Apache HTTP Server:
yum install httpd

1 of 8

2/4/2012 5:48 PM

issue the following command: yum install php php pear If you're also hoping to run PHP with mysql. like so: cp /etc/httpd/conf/httpd. issue the following command: yum install mod_python If you need support for MySQL in Python.conf ~/httpd. issue the following command: yum install mod_perl To install Python support.conf extension in /etc/httpd/conf.conf. and should be run if you want to have support within Apache for server-side scripting in PHP. issue the following command: yum install ruby Note that this only installs support for the Ruby programing language. Python.conf file. making regular backups of known working states is highly recommended. then also install mySQL support: yum install php mysql Configure Apache All configuration for Apache are contained in the httpd. These websites can be controlled by different users.backup By default all files ending in the .d/httpd. you will also need to install Python MySQL support: yum install MySQL python To install PHP support. and we recommend placing your non-standard configuration options in files in these directories.linode. To install Ruby support. which is located at: /etc/httpd/conf.com/web-servers/apache/installation/fedora-13 How to Contribute Sitemap Install Support for Scripting The following commands are optional.d/ are treated as configuration files. as you prefer. Regardless how you choose to organize your configuration files. Ruby. Running scripts and applications written in Ruby in web pages will require some sort of CGI handler. Now we'll configure virtual hosting so that we can host multiple domains (or subdomains) with the server. 2 of 8 2/4/2012 5:48 PM . We advise you to make a backup of this file into your home directory. including common support bundles. To install Perl support. or Perl. or by a single user.conf.Install the Apache 2 Web Server on Fedora 13 – Linode Library http://library.

org ServerAlias www.ducklington. however we recommend the method below. the logs directories must be created before you restart Apache.org ServerName ducklington. Begin by adding the following line to the virtual hosting configuration file: File excerpt: /etc/httpd/conf. By default.org/public_html/ ErrorLog /srv/www/ducklington.org/logs mkdir p /srv/www/bucknell.net DocumentRoot /srv/www/bucknell.com/web-servers/apache/installation/fedora-13 There are different ways to set up virtual hosts.linode.net/public_html mkdir /srv/www/bucknell.56. File excerpt: /etc/httpd/conf.56.34.78 with your own IP address.log CustomLog /srv/www/ducklington.net".56. Configure Virtual Hosts Now you will create virtual host entries for each site that you need to host with this server. You can symbolically link these directories into other locations if you need them to exist in other places.34.78:80> ServerAdmin squire@bucknell.net/logs/error.78:80 Be sure to replace 13.d/vhost.org/public_html mkdir /srv/www/ducklington. it is still a good idea to tell Apache what IP address to listen on in case you decide to add more.34.org DocumentRoot /srv/www/ducklington. you can do this with the following commands: mkdir p /srv/www/ducklington.log combined </VirtualHost> <VirtualHost 13. Even if you only have one IP.78:80> ServerAdmin squire@ducklington.net/public_html/ ErrorLog /srv/www/bucknell.org/logs/access.net ServerAlias www.bucknell. but are not required.net ServerName bucknell. For the above configuration.conf NameVirtualHost 13.log CustomLog /srv/www/bucknell.Install the Apache 2 Web Server on Fedora 13 – Linode Library http://library.34. Before you can use the above configuration. You must configure it to listen only on addresses you specify. you'll need to create the specified directories.org/logs/error. Here are two examples for sites at "ducklington.log combined </VirtualHost> Notes regarding this example configuration: All of the files for the sites that you host will be located in directories that exist underneath /srv/www.56. If they are defined (as shown above). issue the following command to run Apache for 3 of 8 2/4/2012 5:48 PM .org" and "bucknell.net/logs After you've set up your virtual hosts.net/logs/access.d/vhost. Apache listens on all IP addresses available to it.conf <VirtualHost 13. ErrorLog and CustomLog entries are suggested for more fine-grained logging.

as most control of Apache can be administered from files included in the conf.backup 1 Generally. though you can split site-specific configuration information into additional files if needed. which can help administrators avoid unforeseen conflicts.conf. with items specified later taking precedence over earlier and potentially conflicting options: 1. /etc/httpd/conf/httpd. but Apache configuration is also loaded from files in a number of different locations. the main configuration file is located at /etc/httpd/conf/httpd.linode. Remember.conf`` extensions in /etc/httpd/conf. In the default installation of Apache 2 on Fedora 13.Install the Apache 2 Web Server on Fedora 13 – Linode Library http://library. Apache will follow symbolic links to read configuration files. we do not recommend modifying the default configuration file in most cases.conf /etc/httpd/conf/httpd conf. files will be read in order based on an alpha-numeric sort of their file names. In accordance with best practices.conf file.com/web-servers/apache/installation/fedora-13 the first time: /etc/init.d/httpd start Assuming that you have configured the DNS for your domain to point to your Linode's IP address. Within a directory of included configuration files. as well as backups of known-working states. virtual hosting for your domain should now work.d/ directory are read in order. This will help you quickly restore your server to a working state in case your modifications introduce an unforeseen error. If you do decide to edit httpd. sorted by file name. so you can create links in these directories and locations to files that are actually located elsewhere in your file system. later files take precedence over earlier-cited files.conf 2.d/vhost.d/httpd reload Configuration Options One of the strengths. in a specific order. or any other Apache configuration remember to reload the configuration with the following command: /etc/init. Files with``. there are few web serving tasks that Apache 4 of 8 2/4/2012 5:48 PM .conf.d/ directory. as specified above and in our LAMP guide for Fedora 13 configuration files related to virtually hosted sites should be located in hosts should be located in a specific virtual host file.conf. Configuration files are read in the following order. cp /etc/httpd/conf/httpd. Install Apache Modules One of Apache's prime strengths is its extreme customizability and flexibility. Any time you change an option in your vhost. Remember that you can create as many virtual hosts with Apache as you need. such as /etc/httpd/conf. With its support for a large number of modules. make a backup of the standard configuration file. and obstacles. of Apache is the immense amount of flexibility offered in its configuration files.

use /srv/www/bleddington.htaccess file apply to all directories below the file.com/. To see if a module is enabled. note that all options specified in . Password Protecting Directories In a non web accessible directory. modules are located in the /etc/httpd/modules/ directory. The following two grep commands should generate a list of currently available modules: grep ^LoadModule /etc/httpd/conf/httpd. Entering configuration options in these files allow you to control Apache's behavior on a per-directory basis.com/ 5 of 8 2/4/2012 5:48 PM . Consult the Apache module documentation for more information regarding the configuration of specific modules. Configuration directives for the default modules are located in /etc/httpd /conf/httpd. we need to create a . Remember that options specified in an . This allows you to "lock" a directory behind a password wall (for instance) to prevent general access to it. if the document root for your Virtual Host is /srv/www/bleddington. If this kind of configuration organization is desirable for your setup you can specify directory-level options using <Directory > blocks within your virtual host.htaccess files can specify higher level configuration locations.d/* To disable an existing module (at your own risk) edit the file in question.com /public_html/. Furthermore. For example.htaccess files are a common location to specify rules for rewriting URLs. directory specific .conf grep ^LoadModule /etc/httpd/conf. while configuration options for optional modules installed with yum are generally placed in . though you may have to apply additional configuration options to have access to the modules' functionality. #). Understanding .htaccess file is the Apache configuration interface that many webmasters and developers have the most experience with.g. To get a list of available Apache modules modules in the Fedora repository use the following commands: yum search mod_ You can then install one of these modules with the command: yum install mod_[module name] Modules should be enabled and ready to use following installation. Enter this directory: cd /srv/www/bleddington. Additionally. and comment out the LoadModule statement by prefixing the line with a hash (e.Install the Apache 2 Web Server on Fedora 13 – Linode Library http://library.linode.com/web-servers/apache/installation/fedora-13 cannot fulfill.conf. By default.htpasswd file.conf files in /etc/httpd/conf. look in "conf" files for lines beginning with LoadModule statements.htaccess Configuration The .d/.

htpasswd file you should not use the -c option (which creates a new file).com/. you may create any number of separate rewrite rules. meaning that the rewrite engine won't rewrite strings that partially match the pattern. add the following lines: File excerpt: .htpasswd).com/web-servers/apache/installation/fedora-13 Using the htpasswd command we'll create a new password entry for a user named cecil: htpasswd c . Rewriting URLs with mod_rewrite The mod_rewrite engine is very powerful. Also. which might be prudent if you wanted to store a number of . enable mod_rewrite with the following line: File excerpt: Apache Virtual Hosting Configuration File or . First.htaccess RewriteRule ^post id/([0 9]+)$ /posts/$1. The second string specifies the actual files to be served. the server provides an alternate page. and the $ matches to the end of the string. In the . Although the capabilities of mod_rewrite far exceed the scope of this section.htpasswd cecil Note. These rules provide a pattern that the server compares incoming requests against.linode. you can specify an alternate name for the password file (eg.htaccess AuthUserFile /srv/www/bleddington. we hope to provide a brief outline and some common use cases.htaccess file. Furthermore.Install the Apache 2 Web Server on Fedora 13 – Linode Library http://library. or -s for SHA hashes.htpasswd files for different directories in the same location. Here is an example rewrite rule: File excerpt: Apache Virtual Hosting Configuration File or .htaccess file for the directory that you want to protect. and if a request matches a rewrite pattern. .htaccess RewriteEngine on Now. that the AuthName is presented to the user as an explanation in the authentication dialog for what they are requesting access to on the server.htpasswd AuthType Basic AuthName "Advanced Choreographic Information" Require valid user Note. note that when you're adding additional users to the . In a <Directory > block or .html Let's parse this rule. and is available for your use by default. These usernames and passwords need not (and should not) correspond to system usernames and passwords. note that the first string is the pattern for matching against incoming requests. Mod_rewrite patterns use regular expression syntax: the ^ matches to the beginning of the string. you can specify how passwords are encrypted/hashed with the -m flag for MD5. 6 of 8 2/4/2012 5:48 PM .

please note that we cannot vouch for the accuracy or timeliness of externally hosted materials. There are many other possibilities for using mod_rewrite to allow users to see and interact with useful URLs. while maintaining a file structure that makes sense from a development or deployment perspective. Apache Configuration Apache HTTP Server Version 2. April 29th. More Information You may wish to consult the following resources for additional information on this topic. [0-9]+).linode.com/web-servers/apache/installation/fedora-13 The string in question rewrites all URLs that specify paths that begin with /post-id/ and contain one or more numbers (eg.html file in the /posts/ directory. $2.0 United States License. 2011 (r1449). Last edited by System on Friday. The parenthetical term or terms in the pattern specify a variable that is passed to the second string as $1.Install the Apache 2 Web Server on Fedora 13 – Linode Library http://library. Got a comment? 7 of 8 2/4/2012 5:48 PM .2 Documentation URL Rewriting on HTML Source This guide is licensed under a Creative Commons Attribution-NoDerivs 3. While these are provided in the hope that they will be useful. serving a corresponding . $3 and so forth.

E-mail addresses are confidential.com/web-servers/apache/installation/fedora-13 BBCode formatting is allowed.Install the Apache 2 Web Server on Fedora 13 – Linode Library http://library.linode. and are only used for Gravatar images and future feedback. All comments are moderated and may take some time to appear on this page. Please refer to our privacy policy . Name (optional) E-mail (optional) Comment Type the two words: 8 of 8 2/4/2012 5:48 PM .

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->