Link to home
Start Free TrialLog in
Avatar of Paulmul
Paulmul

asked on

Using webserver Redhat 9.0

Hi,

how do I use the webserver in redhat 9.0 I have it installed but do not know how I can test my HTML/CGI files using it. I am only planning on using it locally and not putting it online.

Thanks,

Paul
Avatar of liddler
liddler
Flag of Ireland image

Assuming your webserver is apache, find your config file (httpd.conf), which might be in /usr/local/apache/conf or /etc/apache/conf, and in it set your DocumentRoot to the directory your HTML files are stored
Avatar of Paulmul
Paulmul

ASKER

My linux isn't great, could you explian that a little simpler, how to do it?

Thanks
first do you know where your httpd.conf file is?
If not
find / -name httpd.conf

Do you know whether you are running apache 1.3 or 2?

Then in the file, you need a directives like:

ServerName www.example.com
DocumentRoot /var/www/http

If you are not sure, post your httpd.conf here
Avatar of Paulmul

ASKER

I don't even know if it is apache, I just installed what came with the redhat 9.0 cd. I found my httpd.conf it is a very long file. I will post it if you like but if you tell me what part to post or where I should write this in I can do that.

Thanks
Avatar of Paulmul

ASKER

Found <URL:http://httpd.apache.org/docs-2.0/> in the file, I suppose that means it i s apache 2.0

Paul
Avatar of Paulmul

ASKER

Ok I made some progress on my own. I have found my httpd directory. Should I set up cgi-bin and html folders in here?
Yes,
Most of the default httpd.conf file is commented out and it has lots of comments in it trying to explain to you what is does.
Really you should try and read them (I know it is long and boring)
You can make a copy of the httpd.conf file with out the comments in by doing this
grep -v ^# httpd.conf >httpd.conf.new
mv httpd.conf httpd.conf.old
mv httpd.conf.new httpd.conf
This will be a much smaller and simpler file, then if you don't understand any of the directives, go to the relevent section of the httpd.conf.old file or look at the directions section on the apache website.

There should be a logs directory next to the conf directory where you found the httpd.conf, try and start apache (apachectl start) and look in the errors file
Avatar of Paulmul

ASKER

I found (I know I'm lazy) a www folder with http and cgi-bin sub directories. I assume this is my webserver. I have put files in the relevant directories but when I try to run perl it just opens the file, how do I change this?

Also I upped the points since this is technically another question.

Paul
Yes thats where you can put your html & cgi docs.
You should have another file in the conf directory called mime.types, this will associate different extensions (i.e. .cgi or .pl) with different applications

Avatar of Paulmul

ASKER

Ok I found that, how do I add perl to it? When I add perl should the webserver see .pl and .cgi files?
Do I have to start apache or is that running?

Sorry about all the questions.
ASKER CERTIFIED SOLUTION
Avatar of liddler
liddler
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Paulmul

ASKER

When I type that it says command not found, I have tried it in several directories including the one where apachectl is located.

Avatar of Paulmul

ASKER

I'm getting closer, Still not seeing perl properly but I think I nearly have it.

Thanks again
IF you are in a directory (any directory) and you want to run a command that is located in that directory, you need to prepend your command with ./
so in the apache bin direcetory type
./apachectl start
in RedHat 9 you can type

service httpd start

from the command line to get Apache started or

service httpd restart

to restart the Apache service if you have made any changes to the /etc/httpd/conf/httpd.conf file