Help with apache

Status
Not open for further replies.

poertner_1274

Posts: 3,874   +3
Ok, I just got apahce installed on my Red Hat box. I was wondering how or where I need to put a default web stuff. I am not sure how to really explain it. Right now if I connect to the ip with apache on it it shows the default apache server stuff. I was wondering where that was stored, and how I could change it. I am installing a program that will write to that directory/file if I can find it.

I hope someone can decifer this, if not I'll try and explain it better, if I can figure out a way.
 
It should be in a folder called htdocs inside the Apache root directory.

Just a reminder, I'm only familiar with the Windows version. I am guessing that the setup and configuration are very simliar though.
 
If you can't be bothered, here's the really important stuff:

Setting up the Server
During the installtion of the apache RPM, several directories will be created on your system:


/etc/httpd/conf - configuration files
/var/log/httpd - log files
/home/httpd/html - where your HTML files will go
/home/httpd/cgi-bin - where CGI programs go
/home/httpd/icons - some icons used for directory indexing, etc.

A sample home page will be installed in /home/httpd/html, and several sample CGI programs will be installed in /home/httpd/cgi-bin.

Before starting up the server, you will want to take a look at some of the configuration files in /etc/httpd/conf. These include:

NOTE:Newer versions of Apache use a single configuration file. At the present time (10-18-99) Red Hat has NOT shipped a version in this format but plans to for future releases.


access.conf: This file controls access to your web server. One of the things you might want to change here are the ``allow'' and ``deny'' lines, which restrict who can get web pages. By default, all hosts are allowed. You may, for instance, want to change this so that all hosts are allowed, except for one problem host:
<Limit GET>
order deny,allow
allow from all
deny from b1ff.eleet.com
</Limit>

This will prohibit the host b1ff.eleet.com from accessing the server, but allow all other hosts. Another example is to restrict access to only your own domain (for an internal web server):
<Limit GET>
order deny,allow
deny from all
allow from gizmonics.edu
<Limit GET>

This allows only hosts in the gizmonics.edu domain to access to server.
httpd.conf: This is the main file for configuration information for your web server. Below are some of the entries you will need to modify to fit your site.
The first things you will want to look through and modify for your web server will be the modules that are loaded. These are all based on your prefernce or need, a general rule is: If you don't know what it does, you probably don't need it. Read the documentation to learn more about each module, the features and problems of it and decide if you need it below is what this section looks like on my server, yours may vary.


# Documentation for modules is in "/home/httpd/manual/mod" in HTML format.

#LoadModule mmap_static_module modules/mod_mmap_static.so
LoadModule env_module modules/mod_env.so
LoadModule config_log_module modules/mod_log_config.so
LoadModule agent_log_module modules/mod_log_agent.so
LoadModule referer_log_module modules/mod_log_referer.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule status_module modules/mod_status.so
LoadModule info_module modules/mod_info.so
LoadModule includes_module modules/mod_include.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule asis_module modules/mod_asis.so
LoadModule imap_module modules/mod_imap.so
LoadModule action_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule proxy_module modules/libproxy.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule anon_auth_module modules/mod_auth_anon.so
#LoadModule dbm_auth_module modules/mod_auth_dbm.so
LoadModule db_auth_module modules/mod_auth_db.so
LoadModule digest_module modules/mod_digest.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule example_module modules/mod_example.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so

# Extra Modules
#LoadModule php_module modules/mod_php.so
#LoadModule php3_module modules/libphp3.so
LoadModule perl_module modules/libperl.so

# Reconstruction of the complete module list from all available modules
# (static and shared ones) to achieve correct module execution order.
# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]
ClearModuleList
#AddModule mod_mmap_static.c
AddModule mod_env.c
AddModule mod_log_config.c
AddModule mod_log_agent.c
AddModule mod_log_referer.c
AddModule mod_mime_magic.c
AddModule mod_mime.c
AddModule mod_negotiation.c
AddModule mod_status.c
AddModule mod_info.c
AddModule mod_include.c
AddModule mod_autoindex.c
AddModule mod_dir.c
AddModule mod_cgi.c
AddModule mod_asis.c
AddModule mod_imap.c
AddModule mod_actions.c
AddModule mod_speling.c
AddModule mod_userdir.c
AddModule mod_proxy.c
AddModule mod_alias.c
AddModule mod_rewrite.c
AddModule mod_access.c
AddModule mod_auth.c
AddModule mod_auth_anon.c
#AddModule mod_auth_dbm.c
AddModule mod_auth_db.c
AddModule mod_digest.c
#AddModule mod_cern_meta.c
AddModule mod_expires.c
AddModule mod_headers.c
AddModule mod_usertrack.c
#AddModule mod_example.c
#AddModule mod_unique_id.c
AddModule mod_so.c
AddModule mod_setenvif.c

# Extra Modules
#AddModule mod_php.c
#AddModule mod_php3.c
AddModule mod_perl.c

The apache web server can be run from either /etc/inetd.conf or as a standalone server. I recommend running it as a standalone for performance and resource reasons, however this is simply a matter of preference and need.


ServerType standalone

Now you get to choose what port you want your web server to listen for connections on, port 80 is the standard port, you can however move it to another port if you would like, just remember to give the port number to people when giving out your website. Note: For ports < 1023 you will need to be root to start the server.


Port 80

It is probably a good idea to leave the web server on port 80.

The HostnamesLookups feature is turned off by default, you can enable this by changing off to on on the line like the one below.


HostnameLookups off

This is off so that you will have to turn it on, it will reduce performance slightly as it looks up the host when it gets a connection, but will log the hostname of the client as opposed to just the ip of the client.

The next thing you need to edit is the user and group the webserver it runs as, the default is user nobody and group nobody it is probably a good idea to leave it this way for security reasons. This can be changed to run as a user by changing the lines similar to the ones below.


User nobody
Group nobody

One thing you'll need to edit will be the server admin.


ServerAdmin webmaster@spaceghost.com

The server admin is going to be the person in charge of handling your webserver, typically it is a good idea to set this to webmaster@yourdomain.com, and then alias webmaster to the person responsiable in the /etc/aliases and then run the


/usr/bin/newaliases

The next thing you need to check will be the ServerRoot settings. This is the top of the directory tree under which the server's configuration, error, and log files are kept. NOTE! If you intend to place this on an NFS (or otherwise network) mounted filesystem then please read the LockFile documentation available at Apache

The Default for Red Hat Linux systems are:


ServerRoot "/etc/httpd"

You dont really need to change this, as the Apache is compiled for this path, but you can recompile Apache and move it somewhere else.

If you want to run ``virtual hosts'', this is where you'll set up that information. Virtual hosts are beyond the scope of this document - consult the Apache documentation at Apache for more on this.


mime.types: You shouldn't change anything in here.
srm.conf: This file contains information about directories, files, and file types on your server. Most of this can be left as is; however, if you want to support server-side includes on your server, you should uncomment some of the AddType lines, as indicated in the file's comments. Server-side includes are a potential security risk, so they are disabled by default.
 
Starting up a Web Site
Now you're ready to start adding pages to your web server. Just move any HTML files, graphics, etc. you want to appear on your server into the /home/httpd/html directory. You can create subdirectories in here as well. Make sure that any files intended for public viewing are set to be world readable:


chmod a+r (name-of-file)

The file named index.html will be loaded by default if no file name is specified in the URL; that is,


http://yourhost.com/index.html

is the same as


http://yourhost.com/

So, you should name the main home page of your server as index.html.

You should be all set to go now; to start up the server, just type as root:


httpd

(The next time you boot your system, the server will start automatically.)

Try using a web browser to access your server. From X you could use:


lynx http://localhost/

If you get your home page, you're all set! If not, you may get some errors. These are common:


``File Not Found: the file index.html was not found on this server'' means you need to create an index.html file, as indicated above.
``Forbidden: you're not allowed to access index.html on this server'' means you need to make the index.html file world-readable:
chmod a+r /home/httpd/html/index.html

source: http://www.redhat.com/support/resources/tips/WWW-Server-Tips/WWW-Server-Tips.html
 
I will take a look at that, but I guess I didn't mention I installe one off of apache's website, not an rpm. I'm not sure if they work the same or not, but I'll check that site out.
 
Status
Not open for further replies.
Back