configuring apache on linux for mod_rewrite and mysql
Change
AllowOverride none
To: Code:
AllowOverride all
in etc/httpd/conf/httpd.conf : add
Configuring the Apache Server
Apache configuration traditionally involves three files:
- httpd.conf
-
This is the primary configuration file. It traditionally contains configuration settings for the HTTP protocol and for the operation of the server. This file is processed first.
- srm.conf
-
This file traditionally contains configuration settings to help the server respond to client requests. The settings include how to handle different MIME types, how to format output, and the location of HTTP documents and Common Gateway Interface (CGI) scripts. This file is processed second.
- access.conf
-
This file traditionally defines access control for the server and the information the server provides. This file is processed last.
Different systems put the httpd.conf file in different directories. On a Solaris system, the file is stored in the /etc/apache directory; on a Red Hat system, it is found in the /etc/httpd/conf directory; and on Caldera systems, in the /etc/httpd/apache/conf directory. The Apache manpage should tell you where httpd.conf is located on your system; if it doesn't, look in the script that starts httpd at boot time. The location of the httpd.conf file will either be defined by a script variable or by the -f argument on the httpd command line. Of course, a very simple way to locate the file is with the find command, as in this Caldera Linux example:
# find / -name httpd.conf -print
/etc/httpd/apache/conf/httpd.conf
11.2.1. Configuring Apache on Solaris
The first step to configure Apache on a Solaris system is to copy the file httpd.conf-example to httpd.conf:
# cd /etc/apache
# cp httpd.conf-example httpd.conf
Use an editor to put valid ServerAdmin and ServerName values into the configuration. In the Solaris example, we change ServerAdmin from:
ServerAdmin you@your.address
ServerAdmin webmaster@www.wrotethebook.com
#ServerName new.host.name
ServerName www.wrotethebook.com
# /etc/init.d/apache start
httpd starting.
# ps -ef | grep '/httpd'
nobody474 473 0 12
:57:27 ? 0:00 /usr/apache/bin/httpd
nobody475 473 0 12
:57:27 ? 0:00 /usr/apache/bin/httpd
nobody476 473 0 12
:57:27 ? 0:00 /usr/apache/bin/httpd
root 473 1 0 12:57:26 ? 0:00 /usr/apache/bin/httpd
nobody477 473 0 12
:57:27 ? 0:00 /usr/apache/bin/httpd
nobody478 473 0 12
:57:27 ? 0:00 /usr/apache/bin/httpd
root501 358 0 13
:10:04 pts/2 0:00 grep /httpd
After running the apache startup script, run ps to verify that the httpd daemon is running.[126] In this example, several copies of the daemon are running, just as we saw earlier in the Linux example. This group of daemons is called the swarm, and we'll examine the Apache configuration directives that control the size of the swarm later.
Now that the daemons are running, run Netscape. Enter "localhost" in the location box, and you should see something like Figure 11-3.
Figure 11-3. Default web page on a Solaris server
The DocumentRoot directive points the server to the directory that contains web page information. By default, the Solaris server gets web pages from the /var/apache/htdocs directory, as you can see by checking the value for DocumentRoot in the httpd.conf file:
# grep '^DocumentRoot' httpd.conf
DocumentRoot "/var/apache/htdocs"
# ls /var/apache/htdocs
apache_pb.gif index.html
The /var/apache/htdocs directory contains only two files. The GIF file is the Apache feather graphic seen at the bottom of the web page in Figure 11-3. The index.html file is the HTML document that creates this web page. By default, Apache looks for a file named index.html and uses it as the home page if a specific page has not been requested. You can put your own index.html file in this directory, along with any other supporting files and directories you need, and Apache will start serving your data. Alternately, you can edit the httpd.conf file to change the value in the DocumentRoot directive to point to the directory where you store your data. The choice is yours. Either way, you need to create HTML documents for the web server to display.
Although the Solaris server can run after modifying only two or three configuration directives, you still need to understand the full range of Apache configuration. Given the importance of web services for most networks, Apache is too essential for you to ignore. To properly debug a misconfigured web server, you need to understand the entire httpd.conf file. The following sections examine this file in detail.
References:- http://www.unix.com.ua/orelly/networking_2ndEd/tcp/ch11_02.htm
RewriteEngine on



![Validate my RSS feed [Valid RSS]](http://feedvalidator.org/images/valid-rss.png)