|
|
|
|
|
|
The Apache 2 Web-ServerThese notes show how to install Apache 2 and then how to configure it to enable users to have their own web sites, with http://yourdoman/~user as the url. We will look at the situations in both unix (Ubuntu) and cygwin.The procedures detailed on this page work for me. However, depending on your syatem configuration, they may not work for you without modification. Apache remains a key component in the vast majority of networks on the Web, currently running more than half of the world's sites. The latest version, Apache 2.2, is a major enhancement over the earlier versions of 2.0 and 2.1. In particular, the default configuration layout has been simplified and modularised.
Get and Install Apache 2Ubuntu and other Unix Flavors (gzipped tarball)I recommend downloading the gzipped tarball and complining from source. Do not forget to read all the INSTALL and README files. Compiling from source gets over the major problem with Ubuntu (and other unix flavors) in that its package manager (“synaptic”) never seems to have the latest versions of software. I had no problems installing Apache 2.2.15 on Ubuntu 7.04 using:
make sudo make install Ubuntu (download manager)Getting Apache2 is straightforward using the download manager (“Synaptic”). It is the only option if you are unhappy about installing from the source code, but you will probably only get the older Apache 2.1. Synaptic usually installs Apache 2 into the root /usr/share/apache2. CygwinFortunately, the cygwin package manager has Apache 2.2 available so it is therefore easiest to use this route rather than download the source code. However, for Apache2 to work in cygwin, the cygwin server (see below) must also be installed and running. The cygwin package manager installs Apache 2.2 into the root /usr/share/apache2.Installation Directories for Two Root Locations
Starting Apache2Depending on the root location, you start Apache2 by entering either the command /usr/local/apache2/bin/apachectl2 start or the command /usr/sbin/apachectl2 start. In ubuntu, you will probably also have to use sudo. Confirm all is working normally by pointing a browser to http://localhost or to http://127.0.0.1. You will then see the message It Works! The URL http://your_host may also work if the name of your host is in the host file.In cygwin, you might get a Windows Security Alert when you attempt to start Apache2. The Alert comes from your Firewall, with the message:
Name of program: httpd2 Local-User Web SiteFirst, we construct the directory for the html pages. We will do the same for a Local-User cgi-bin Directory below. We keep the default setting whereby the local-user web files are in the /home/user/public_html directory.Unix (Ubuntu)
(3) Open the file user.conf with a text editor. You will find it in
The file user.conf should look something like this:
(4) Restart the apache2 server. The simplest way is to enter
When you start apache2, you may receive a Windows Security Alert from your Firewall asking if you want to keep blocking the program httpd2. (See above.) Click to unblock. CygwinUnfortunately, the apache2 server on cygwin has its files arranged differently from the unix case.(A) First, do the same as (1) above in order make the public_html and cgi-bin directories. (B) You now edit the file httpd.conf. This file is found in the directory /etc/apache2. It would be wise to make a copy of httpd.conf before editing. Now insert the following:
Click here for my complete http.conf file to see where I inserted the lines. Look about 2/3 of the way down for the line # Begin added by C Baxter. (C) Now restart the apache2 server. Remember that the cygwin server (see below) must also be running for apache2 to function. Local-User cgi-bin DirectoryThe procedure is the same for unix (Ubuntu) and cygwin.Go into /home/user/public_html and do mkdir cgi-bin. This makes the cgi-bin directory as a sub-directory of public_html. We now have to set the permissions of the cgi-bin directory. While still in /home/user/public_html do chmod a+xr cgi-bin or chmod 755 cgi-bin. Remember to set all the perl scripts in the cgi-bin directory to the same permissions. That's it! Cygwin ServerTo ensure you have a cygwin server installed, enter cygwin-config in the cygwin bash shell. You will be asked:
(Say "no" if it's already installed as service) (yes/no) In the past, you had to set the system environment CYGWIN to server. This is no longer necessary with Cygwin 1.7. To start the cygwin server enter net start cygserver. This is a C:\WINDOWS\system32 program so that directory has to be in the path if you enter net start in a bash shell. Alternatively, you can start the cygwin server with the /bin program cygrunsrv -S cygserver. To stop the cygwin server, use either net stop cygserver or cygrunsrv -E cygserver. |
||||||||
|
|