LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Setting up a web server, using Red Hat 9 (https://www.linuxquestions.org/questions/linux-networking-3/setting-up-a-web-server-using-red-hat-9-a-172132/)

Ricochet423 04-19-2004 01:44 PM

Setting up a web server, using Red Hat 9
 
I recently, downloaded and installed Red Hat 9 for the sole purpose of creating a web server. This is harder than I thought. I do not even know the basics of starting a web server. If anyone has any links, or can help me, it would be greatly appreciated. All I want is a simple http server, that can run php and possible cgi.

By the way, I am extremely new with linux. So please be as specific as possible.

Also I am running Windows XP off my good computer, which is connected to me router. My linux box is connected to the same router.

david_ross 04-19-2004 01:58 PM

Welcome to LQ.

Where are you running into problems? Did you install apache and php when RedHat was installed?

Ricochet423 04-19-2004 02:02 PM

yes, I did. this is the first time I ever installed any kind of Linux os. It just does not seem to be working for me. I can't understand how to set up the apache server.

david_ross 04-19-2004 02:10 PM

Ok a few things to check - can you post he output of the folowing commands...

Check to see if apache is running and listening for connections:
netstat -nlp

Check to see what firewall rules you have:
iptables -nL

ysg08 04-19-2004 02:23 PM

Here is what you do:

If you installed apache/php and all that good stuff during the Red Hat installation, everything is done for you.

To start apache, type /usr/sbin/apachectl start

you will see some messages that it is starting. By the way, you might get a message like....."warning, can't locate host, using 127.0.0.1 instead". dont worry, you should still be oK. Now to check to see if apache is listening type netstat -natu . You should a whole lot of lines come up. Look for one that looks similar to this:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN

you are looking to see if port 80 (the standard web server port) is listening. If you see this and you didnt get any error messages when you typed apachectl start earlier, you are all set to go. Your box is ready to accept incoming requests.

Now to test if your web server is running.

open up a browser and type http://localhost or http://127.0.0.1

You should see a welcome screen by apache and a congratulations message.

To modify the page to your liking, you just have to edit the index.html file in /var/www/html/ folder.

Concerning php, if you installed it during the installion of Red Hat, you can check to see if its there by typing rpm -q php . if you get an output with php-4.xxxxx, your all set to go. php should be ready to go. you dont have to turn it on or anything.

side note: here are some apache controls you will find useful.
/usr/sbin/apachectl start
/usr/sbin/apachectl stop
/usr/sbin/apachectl restart

hopefully this has solved your problem.

Ricochet423 04-19-2004 02:31 PM

[ric@localhost ric]$ netstat -nlp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:1024 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:1025 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -

udp 0 0 0.0.0.0:1024 0.0.0.0:* -
udp 0 0 0.0.0.0:935 0.0.0.0:* -
udp 0 0 0.0.0.0:68 0.0.0.0:* -
udp 0 0 0.0.0.0:111 0.0.0.0:* -
udp 0 0 0.0.0.0:631 0.0.0.0:* -
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Pathunix 2 [ ACC ] STREAM LISTENING 2461 - /tmp/.gdm_socketunix 2 [ ACC ] STREAM LISTENING 2706 - /tmp/.fam_socketunix 2 [ ACC ] STREAM LISTENING 2580 1935/gnome-session /tmp/orbit-ric/linc-78f-0-4e31c4472cff0unix 2 [ ACC ] STREAM LISTENING 2970 2020/notification-a /tmp/orbit-ric/linc-7e4-0-3722ec9ae24b8unix 2 [ ACC ] STREAM LISTENING 2659 1935/gnome-session /tmp/.ICE-unix/1935unix 2 [ ACC ] STREAM LISTENING 2669 1985/bonobo-activat /tmp/orbit-ric/linc-7c1-0-6b3df58452129unix 2 [ ACC ] STREAM LISTENING 2761 2000/metacity /tmp/orbit-ric/linc-7d0-0-300c5f9a1f097unix 2 [ ACC ] STREAM LISTENING 2690 1987/gnome-settings /tmp/orbit-ric/linc-7c3-0-46db5b269f257unix 2 [ ACC ] STREAM LISTENING 2791 2008/magicdev /tmp/orbit-ric/linc-7d8-0-506b99154857cunix 2 [ ACC ] STREAM LISTENING 2809 2004/gnome-panel /tmp/orbit-ric/linc-7d4-0-506b9915b72beunix 2 [ ACC ] STREAM LISTENING 2234 - /dev/gpmctlunix 2 [ ACC ] STREAM LISTENING 2833 2006/nautilus /tmp/orbit-ric/linc-7d6-0-6c565306721f8unix 2 [ ACC ] STREAM LISTENING 2851 2010/eggcups /tmp/orbit-ric/linc-7da-0-1a41c4c11b859unix 2 [ ACC ] STREAM LISTENING 3015 2014/python /tmp/orbit-ric/linc-7de-0-785580068938funix 2 [ ACC ] STREAM LISTENING 2354 - /tmp/.font-unix/fs7100unix 2 [ ACC ] STREAM LISTENING 2471 - /tmp/.X11-unix/X0unix 2 [ ACC ] STREAM LISTENING 2549 1978/ssh-agent /tmp/ssh-XXqOc4GQ/agent.1935unix 2 [ ACC ] STREAM LISTENING 14646 6824/gnome-terminal /tmp/orbit-ric/linc-1aa8-0-81146dc5bd62unix 2 [ ACC ] STREAM LISTENING 2572 1983/gconfd-2 /tmp

for the iptabes one.. it says command not found :confused:

Ricochet423 04-19-2004 02:34 PM

ysg08.. I've done what u asked and I get this message

[ric@localhost ric]$ /usr/sbin/apachectl start
Syntax error on line 116 of /etc/httpd/conf.d/ssl.conf:
SSLCertificateFile: file '/etc/httpd/conf/ssl.crt/server.crt' does not exist or
is empty

ysg08 04-19-2004 02:45 PM

YOU HAVE TO BE ROOT

you have to be root to do most type of system configurations.

type su and enter

then type in your root password.

it should say something like

root @localhost


anytime you do changes to your system or look up things and you get errors saying you dont have permission or anything like that, it is because you are not logged in as root.

always, always change yourself to root before you do system configurations. Or else you will just about always get error messages. It is designed like this as a security measure.

To exit out of root and go back to your regular user name, just type exit

Ricochet423 04-19-2004 02:52 PM

thank you a lot!

ok.. I finally got the test page working, Now I hope the outside world can access it.

Ricochet423 04-19-2004 02:57 PM

can I connect to this server (to upload files) using ws_ftp? and would my password be the same as my root password for my linux box?

ysg08 04-19-2004 03:08 PM

You can use an ftp client such as ws_ftp but it is really unsecure. you should download WinSCP3 from sourceforge.net. download it to your windows machine and install it. then just type in your local IP of the linux box (should start something like 198.168.x.x as the server and type in your username (probably would want to go with root) and the password. upon logging in, you will see a really easy to use interface where you literally can drag files/folders from your windows computer to your linux box.

Ricochet423 04-19-2004 03:13 PM

there must be something wrong... I have made it to the http://127.0.0.1 but when I come on my other computer... and type in the ip (http://69.60.224.11/)

all I get is a blank browser.. absolutely nothing, but no error message... I am not sure if any of my router settings must be changed.. or i there is something I am missing

ysg08 04-19-2004 03:32 PM

Ok there are two reasons:

First, for the outside world to see your page, you have to configure your router to allow outside traffic in to port 80, as well as which computer will accept connections to 80 (the ip address of your linux box)

you can't type in 69.60.224.11 as the ip of your linux box because that is the IP of literally your router for now. that is why you get a blank page.

this is the process. your internet company assigns you an IP (69.60.224.11). This allows you to get on the internet and browse and lets others find you. When you have a router set up, the router takes this number, and makes up its own internal IP #'s for your house. These numbers usually go something like 192.168.x.x. These numbers are specific to each computer in your house.

eg. 192.168.0.5 might be your linux

if you want the outside world to see your page, you have to configure your router to open port 80 and to forward those requests to your linux box (192.168.0.2) in this example.

NOW, when people type 69.60.224.11, they will be first pointed to your router, then your router will see this as a web connection on port 80 and forward it to the specified computer (the linux box at 192.168.0.5). your linux box is ready for connections to 80 and will see this connection attempt and then display your index.html file in /var/www/html.

think of your router as a gatekeeper. Example, A visitor will ring your bell at your house (the house address is (http://69.60.224.11)and the router will answer the door. The visitor says that he wants to see Mr. Web Page. The router will determine that this is a web connection through port 80 and will direct the visitor to room 192.168.0.5. When the visitor goes to that room, he see's the web page.

The ONLY way visitor can see the web page is by first talking to the router. so you will have to do a little research on your router and figure out how to forward connection requests for port 80 to a specific IP.

Good Luck. You will have to do consult the manual that came with the router or read up on it on the routers webpage. after you configure this, your webserver will be internet viewable.

Ricochet423 04-19-2004 03:46 PM

yes, in the port forwarding section of my router.. I made sure that.. port 80 gets forwarded to 192.168.0.4 (linux box).. this still doesnt seem to work... any reasons why? there must be something else I am missing :confused::confused:

maybe I am entering the incorrect IP address of m linux box? how can I verify what that is?

do I have to edit any settings in the 'apache configuration' ?

Ricochet423 04-19-2004 05:45 PM

any one have any ideas? please


All times are GMT -5. The time now is 03:48 AM.