Apache web server

Guides

Commands

  • apachectl stop
  • apachectl graceful
  • apachectl restart -- to reload the configuration file(s) immediately
  • /etc/init.d/inetd reload -- reload rc.config and other basic files
  • telnet spello.sscnet.ucla.edu 80 (quick way to test if port is working) -- see details
    • type GET to confirm Apache is running -- see details

Configuration files

  • /etc/apache/httpd.conf
  • /etc/apache/srm.conf
  • /etc/apache/access.conf
  • /etc/apache/modules.conf
  • /etc/logrotate.d/apache

Installation history

13 November 2006: directory acccess on apache2

On the new spello (we still grieve the overwriting of the old /dev/hda drive, with the /sh partition!), allow indexes selectively:

pico /etc/apache2/sites-available/default

 <Directory /var/www/>
                Options FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                RedirectMatch ^/$ /apache2-default/
        </Directory>

        <Directory /var/www/marillat>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

Note that what matters here is whether you include "Indexes" in the Options line. This is how this is handled now, instead of .htaccess files. Not sure whether these files are still read and what they can be used for.

17 June 2005: .htaccess on apache

I modified spello:/etc/apache/httpd.conf  from this

AllowOverride None
to this
AllowOverride All
so that .htaccess files would work -- and now they do. Set them up in /share/wikis. To add users,
htpasswd cgi-bin/.htpasswd <user>
and then add an .htpasswd in the wiki directory. Works!

On 26 January 2005 I installed apache 1.3.33-3 on spello. 

On 3 May 2004 I upgraded apache (to 1.3.29.0.2-6) and php4 (to 4.3.4-4) on cyberspace. I get the message,

apache has switched to use logrotate

Some of your logs are stored outside the /var/log/apache directory, so you should edit /etc/logrotate.d/apache to have them automatically rotated.
I didn't do anything about this -- maybe I should tell mose.

On 20 July 2002 I changed the Apache configuration file cyberspace:/etc/httpd/httpd.conf to allow .htaccess to override the default settings with the command "AllowOverride All" -- I could be more restrictive but this seems fine, especially since I'm only using it for Athena Productions.

I also looked into the "EnablePut" command that Mark suggested, but it turns out it needs the module mod_put, which is a possible security risk. It also needs to be integrated and the mod put home page (where you also find the source code) recommends doing this when Apache is compiled. It's possible that mod_put.so just needs to be placed in /usr/lib/apache/, but it may need compiling and it's not clear it's worth the hassle. Netscape Gold apparently uses this put method; cf. info. SuSE may have a module patch.

On 29 April 2002 I determined that the default directory for web pages is /usr/local/httpd/htdocs/ -- logically enough. The http daemon has been running from the beginning of this installation, but I haven't known how to access it. Now I know how to put pages on the server, and am in effect running my own web server finally! Not that it took much of me... I created a link from /home/steen/mnt/web/ to /usr/local/httpd/htdocs/ so that I can move files directly from Spello to Cyberspace (and I should rename the machines in some reasonable fashion), using this command:

ln -sf /usr/local/httpd/htdocs/ /home/steen/mnt/web

Note that the first parameter after -sf (symbolic forced) is the target directory, and the second the new symbolic file. This works beautifully -- I added the site to Dreamweaver.

SuSE days

To do

  • The current e-mail address for the site is ServerAdmin steen@ssc.ucla.edu, as set in /etc/rc.config.d/apache.rc.config. We might want to get an e-mail address for the project, such as cyberspace@ucla.edu, or let mail go to Andrew Liau (if he actually gets something done).
  • Add the PHP module, mod_php
  • Add the WebDAV module mod_dav?

Configuration files

  • /etc/rc.config
  • /etc/rc.config.d/apache.rc.config
  • /etc/httpd/httpd.conf -- this is the main Apache HTTP server configuration file
  • /usr/local/httpd/conf/srm.conf
  • /usr/local/httpd/conf/access.conf

The main server name is currently set as 128.97.211.32, as defined in /etc/rc.config -- this works for the moment. There is currently no way to get to the document root and show the dancing penguin

On 8 May 2002 I renamed this machine from Julie to Cyberspace by using Yast2 | Network configuration and rebooting. I also edited /etc/hosts. In /etc/rc.config I said "yes" to ipv6 admin and to accessing desktop remotely -- I haven't tested this. In Yast2 I also removed some users, namely:pop (dialup), sapdb (SAP demo), dpbox (local ham radio),

I also created the user cyberweb (user ID 501 and pw cy4ucla) through Yast2 and the directory cyberspace under the web serving directory. I gave ownership of this directory to cyberweb with the following command:

chown cyberweb.users cyberspace

I then created a link to this directory from /home/cyberweb with this command:

ln -sf /usr/local/httpd/htdocs/cyberspace /home/cyberweb/cyberspace

so that the user cyberweb can use FTP to access the web page for editing purposes. It all seems to work -- I had to allow local user login in /etc/vsftpd.conf.

On 8 May 02 I received confirmation from Julie Chen that 128.97.184.95 has been assigned the domain name (www).cyberspace.ucla.edu. I really wanted that address to point to the /cyberspace subdirectory -- and Julie writes, "You will need to setup virtual host for the apache web server." I guess I could just define /cyberspace as the server root?

In /etc/httpd/httpd.conf, the main configuration file for the Apache webserver, I found the option to define the root server, currently

ServerRoot "/usr/local/httpd"

I left this alone for the moment, until I've figured out virtual hosts. The document root is a bit different, currently

DocumentRoot "/usr/local/httpd/htdocs"

SuSE complications

In the SuSE distribution, additional 3rd party authentication modules have been added and activated by default. These modules interfere with the Apache standard modules and cause Basic authentication to fail. Our recommendation is to comment all those modules in /etc/httpd/ suse_addmodule.conf and /etc/httpd/suse_loadmodule.conf which are not actually required for running your server. Source.

The only module that gets loaded through these files is userdir_module -- looks unproblematic.

Virtual Hosts -- from /etc/httpd/httpd.conf

VirtualHost: If you want to maintain multiple domains/hostnames on your machine you can setup VirtualHost containers for them. Most configurations use only name-based virtual hosts so the server doesn't need to worry about IP addresses. This is indicated by the asterisks in the directives below.

Please see the documentation at <URL:http://www.apache.org/docs/vhosts/> for further details before you try to setup virtual hosts.

You may use the command line option '-S' to verify your virtual host configuration.

I defined this set of virtual hosts:

<VirtualHost *>
ServerName cyberspace.ucla.edu
DocumentRoot usr/local/httpd/htdocs/cyberspace
</VirtualHost>

Type apachectl restart to reload the conf file, and httpd -S to see the virtual host configuration. This now works perfectly. For some obscure reason, entering

ServerName www.cyberspace.ucla.edu

made that address consistently go to /usr/local/httpd/htdocs/ even though I explicitly defined a different document root. Anyway, this is fixed, and you are free to use the site for other things aside from CyberSpace@UCLA. Later, you might do something like this:

<VirtualHost *>
ServerName steen.sscnet.ucla.edu
DocumentRoot /usr/local/httpd/htdocs/steen
</VirtualHost>

Plain old http://128.97.184.95/ no longer gets you to the document root and the dancing penguin, which is a pity, but hardly matters -- what actually matters is that you can serve pages from more than one DNS entry from the same IP number..

File permissions

Directories: chmod 755 to allow execution for the web site to be accessible.
Files: chmod 664 to allow both steen and cyberweb to modify pages

I had to give the "umask 002" command to make 664 the default user file creating permission -- in fact, I had to change that in the vsftpd configuration file -- which could actually be useful for vsFTPd purposes, and which is necessary to be able to maintain a joint FTP access to the files. It seems to work fine.

PHP extensions

On 12 May 2002, Andrew Liau said he'd like to use PHP extensions, and I found instructions for how to do it. In brief,

When a Web client requests a PHP-enabled page, the mod_php module gets to interpret the document and make changes to it before the Web server itself sends the results back.

A number of mod_php patches are listed in /var/lib/Yast/patches/i386/update/7.3/patches, but it's not clear it's what I want. I found the RPM file for the mod_php core installation, but it had a slew of dependencies, there were security issues, and the files were not on my SuSE personal distribution CDs. I decided to leave this until I upgrade to SuSE 8.

 

 

 

top
Debate
Evolution
CogSci

Maintained by Francis F. Steen, Communication Studies, University of California Los Angeles


CogWeb