Apache

php and mysql

install php5 php5-mysql to have support for php and mysql

Apache2

this apache2 configuration is very confusing. i guess i need to learn a lot and soon will update this page as i learn and have more time to update…
……09/09/2007 10.10 pm the file that you need to edit are
/etc/apache2/sites-enabled/000-default
/etc/apache2/apache2.conf
Edit the apache2.conf to add the virtual hosts Include /etc/apache2/sites-enabled/
edit the file 000-default which will be the default virtual host
What is favicon.ico

I always wondered about the icons that is displayed in front of the url in the address bar and how to get it. But I never did anything to get that, as I thought that it is an advanced server setup. Recently I found out that there are so many error messages in my apache error_log that favicon.ico is not found. I thought that it is some file in my html code, so i tried to eliminate that line and to my surprise, there was none. Then as usual i googled for favicon.ico. Created one, without knowing what it is going to do and I was astonished when i saw the icon next to the url for my website. Not bad JC.
——03/18/2005 8.25AM
Virtual Hosts and SubDomain

Finally i got it working. I think may be I didn’t try that seriously last time. It has been my dream to develop sub-domains such as
Home Page http://jaya.homelinux.org
Music Page http://music.jaya.homelinux.org
We can do that with the help of Virtual hosts.

DocumentRoot <path_to_my_webdir> Servername jaya.homelinux.org

DocumentRoot <path_to_my_webdir>/music
Servername music.jaya.homelinux.org

The important thing being the declaration of the main domain using virtual host which i missed in my earlier attempts.
———03/09/05 12.31 AM
Install apache, php, mysql, perl

My best advice is don’t install as rpm.
If you need php, mysql, perl everything to work properly install in the following order.
Download the sources from the respective websites
Mysql
openssl
apache Apache
curl curl.haxx.se
php
mod_perl
Don’t worry about the mod_ssl package as that was included with apache up from apache2.
Compile and Install Apache

Download the source tarball from the website and compile with the following options
./configure –enable-so –prefix=/usr/local/apache –enable-ssl=shared
To enable htaccess and htpasswd under the option Directory for the document root
Options Indexes FollowSymLinks
AllowOverride Options FileInfo AuthConfig Limit
Order allow, deny
Allow from all
To enable CGI and Perl script execution, remove the # in front of AddHandler .cgi .pl
———-01-02-2003
Compile and Install Curl

./configure --with-ssl
make
make install

Compile and Install mod_perl

perl Makefile.PL USE_APXS=1 MP_APXS=/usr/local/apache/bin/apxs EVERYTHING=1
make
make install

Edit httpd.conf

< IfDefine SSL>
AddModule mod_ssl.c
< /IfDefine>
AddModule mod_php4.c
AddModule mod_perl.c
User nobody
Group nobody
< IfModule mod_dir.c>
DirectoryIndex index.html index.php
< IfModule>
AddType application/x-httpd-php .php

Limiting access to websites

First edit the httpd.conf as follows which will request apache to check the particular directory for the presence of .htaccess, instead of checking every directory it opens.

< Directory the-directory-you-are-protecting>
Options FollowSymLinks Indexes
AllowOverride AuthConfig
< /Directory >

Restart the apache server.
Create the .htpasswd file by using the following command

/usr/local/apache/bin/htpasswd -c .htpasswd jaya

Copy that file to the DocumentRoot directory
Create the .htaccess file to the folder that you want to protect
Enter the following and save as .htaccess

AuthUserFile /usr/local/myweb/.htpasswd
AuthName "Username and password required"
AuthType Basic
< Limit GET POST >
require user jaya
< /Limit >
Enable CGI-bin

Open the httpd.conf and find this line #ScriptAlias /cgi-bin/ “/usr/local/apache/cgi-bin/”
remove the # and also change the path to where you store your files find this line

#AddHandler cgi-script .cgi

and remove the #
Edit the Directory as follows

< Directory /usr/local/myweb/cgi-bin >
AllowOverride None
Allow None
< /Directory >

If you get an error that it could not spawn the child process make sure that the path to the perl executable is correct.
Enable directory listing

Sometimes we wish to have a directory listing instead of showing the index.html or any files on startup. If you are the administrator for your then you can enable it by
Options Indexes
in httpd.conf. If you don’t have access to the httpd.conf, then you can accomplish the adding the same in .htaccess files
Forbidden Error #403 Blah Blah Blah

If you get this error, first check the User/Group option in the httpd.conf file. If it is set to nobody or blank, then smack yourself on your head or ask somebody else(who will be glad to do for you) and change it to some exisiting group/user in your system, who owns the folders.

Posted in Uncategorized

Comments are closed.