LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Setting up Apache (https://www.linuxquestions.org/questions/linux-newbie-8/setting-up-apache-72063/)

Big Brad 07-12-2003 01:08 AM

Setting up Apache
 
Hi guys I really need some help. I am just new to linux and would really like to set up an Apache web server on a Red Hat 8 machine. I bought a step by step manual thing for $5 off the net but it kind of doesn't offer much in the way of real troubleshooting. So I was kind of hoping some of the more experienced might be able to help me. The manual told me to set up a Virtual Host which I didn't quiet understand. I got the server to work fine just locally as in localhost but could not get it working across my home network. I was planning on setting it up on my home network before buying a domain name or anything. Then taking it and putting it in my dads office behind a nice ADSL connection. So what I am after is just some really basic instructions on how to set up a really basic web server.
Assume I Know Nothing.:scratch:

MasterC 07-12-2003 01:22 AM

Welcome to LQ :)

I do my best to assume the worst, but you've said you successfully shown it as localhost, so I'm thinking this might not be an apache problem, but rather part of a networking access to it problem. First thing I'd like to point you towards is:
http://www.linuxquestions.org/questions/answers.php (it's titled Bulliver)
There has been a tutorial posted up on setting up a LAMP server. What LAMP is:
Linux Apache MySQL PHP
These are common interleaved applications that run on webservers. If you don't find information on setting up apache there, you might look over the docs on www.apache.org

Which version of apache is this? Also, can you describe to us a bit about your network setup? What kinds of machines you have and how they all connect?

Cool

Big Brad 07-12-2003 02:01 AM

Ok I can tell you that all the machines on the network are MS machines and my web server is the only linux box. My Dads Windows 2000 box is the gateway to the www and all the other machines fan out from the hub. I am using the version of Apache that comes with Red Hat 8 what ever that is. I have already had a look at the docs at apache.org but they dont really help. I can get Apache working on windows and all the computers on the network can see my web site. your probably woundering why I dont just host the site with an MS box thats because one day I would also like to set up a mail server and I would really like to learn about linux.

MasterC 07-12-2003 02:10 AM

Yeah, I don't think anyone here would wonder why you wouldn't use linux to run a server ;)

Ok, first thing I'd look at would be dropping your IPTables then. This could easily be what's blocking you (you seem aware enough of your network setup for me to not persue that route). So let's take a peak at what is setup (if anything) with your IPTables (read firewall):
As root type:
iptables -L
If you get command not found, try:
/sbin/iptables -L (or a whereis iptables and then use that path).

And post up the tables returned. To post up from a console to here:
highlight the text to be pasted, click here, and use your middle button (if you don't have a middle button, use your scroll, if neither, use both buttons at the same time).

Cool

Big Brad 07-12-2003 02:48 AM

Here are your IPTables this means nothing at all to me. It is all another language.


Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Lokkit-0-50-INPUT all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain RH-Lokkit-0-50-INPUT (1 references)
target prot opt source destination
ACCEPT udp -- ns1.brad.com anywhere udp spt:domain dpts:1025:65535
ACCEPT tcp -- anywhere anywhere tcp dpt:http flags:SYN,RST,ACK/SYN
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
REJECT tcp -- anywhere anywhere tcp dpts:0:1023 flags:SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT tcp -- anywhere anywhere tcp dpt:nfs flags:SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT udp -- anywhere anywhere udp dpts:0:1023 reject-with icmp-port-unreachable
REJECT udp -- anywhere anywhere udp dpt:nfs reject-with icmp-port-unreachable
REJECT tcp -- anywhere anywhere tcp dpts:x11:6009 flags:SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT tcp -- anywhere anywhere tcp dpt:xfs flags:SYN,RST,ACK/SYN reject-with icmp-port-unreachable


:)

MasterC 07-12-2003 03:21 AM

For now, let's flush em and see if you get a connection:
iptables -F

This basically will turn off your firewall.
After this, try connecting to the machine (you are connecting by IP for now right? And it's an internal/private IP right?...)

Just so you know, I believe RH comes with a graphical utility to do all of this, you might look in your Control Center for a mention of firewall.

:)

Cool

Big Brad 07-12-2003 08:13 AM

Ok I have managed to get it to work by just tweaking a couple firewall settings. I went and had a look for that graphical utillty you were talking about and I found it. Thanks

Could you give me a little bit of a fill in on Virtual Hosts because when I come to sort this out for real I would like to know what I am doing.

MasterC 07-12-2003 08:31 AM

Virtual Hosts is not nearly as bad as it will sound when reading about it. It's (in a nutshell) the ability to have more than 1 httpd.conf file all in 1 httpd.conf file. Near the end of your httpd.conf should be an example of the Virtual Hosts directive and comments explaining each function.

I don't know much about Apache 2.x so everything I talk about is related to 1.3.x
The Virtual Hosts directive can either be bound to an IP or a domain name. Assuming this site goes live, this domain will actually have to be registered through a DNS registar (such as www.godaddy.com ). If your ISP blocks port 80 you'll want to bind your Apache to a different port, and then follow the instructions (or similar instructions) here:
http://www.zoneedit.com/doc/faq.html#faq21

Finally, make sure you remember that when you make changes to your httpd.conf file that you restart apache each time. This can be several ways, distro-independant should be:
apachectl restart
Or:
/sbin/apachectl restart

Lets see, what else...
If/when you make Alias definitions, be sure to place them inside the VirtualHost directive, and more importantly, in the correct one.
Just about any of the actual Apache directives can work inside the Virtual Host directive. The exceptions that come to mind are:
user/group apache runs as... Basically the "Global Environment" directives should be addressed globally ;)

HTH

Cool

softgun 07-12-2003 11:43 AM

Sorry to barge in but...

I too am setting up Apache for the first time. When I start Apache in etc/init.d by typing apache, it says that it cannot get the domain name of the server and will default to 127.0.0.1.

It works on the machine but i cannot log in from any of the clients.

ANy explanation? Or is it a question for Obviousman?

MasterC 07-12-2003 06:47 PM

:) Have you edited your httpd.conf file at all? You'll need to edit it to match your needs/situation. You'll also wanna provide a hostname to your server, that is set different ways on different distros, but it's discussed frequently so a search for "set hostname" will probably reveal your answer on that.

Cool

Big Brad 07-12-2003 07:47 PM

Thanks alot you have really helped me. I have even got the other computers on the network to see the site through a domain name buy stearing them to my dns server. Now all I have to do is go and buy a domain name. Once again thanks for all your help.

MasterC 07-12-2003 07:49 PM

You're welcome, glad I could help ;)

Cool

Big Brad 07-12-2003 11:15 PM

One more thing. For example if you had an ADSL connection with a fixed IP address and an IPCOP firewall then you would put the webserver in the DMZ right. But because of the nice firewall how does the requests for my web site get directed to my web server.

MasterC 07-12-2003 11:53 PM

Is your IPCOP on your same box? You'll need to enable port forwarding, or if it's on the same box (while I'm not too familiar with IPCOP I'll cover what needs to be done) you'll need to ensure the port is simply open for connections (accept all).

In short, Port Forwarding. You'll need to read your IPCOP documentation (or post up a new thread about it if it's not clear and a search reveals too little) on how to do port forwarding.

Cool

**Edit, I found the page for you:
http://www.ipcop.org/1.3.0/en/admin/...es_portforward
**

softgun 07-13-2003 04:22 AM

Thanks MasterC:)

I am reading all about the conf file. Next week I will get Apache galloping off to the wide blue yonder....

Er...
If it's not even trotting i might be back:o


All times are GMT -5. The time now is 01:39 AM.