Solved

How do i start up apache in linux?

Posted on 2001-08-07
23
303 Views
Last Modified: 2012-05-04
Hi,
i've just installed apache in mandrake linux.

how do i test apache?
and
how do startup apache and shutdown?
and there are any startup options i should be aware of?

regards
peewee
0
Comment
Question by:Peewee
  • 10
  • 9
  • 2
  • +2
23 Comments
 
LVL 2

Expert Comment

by:vipulgupta
Comment Utility
find wher apache binary is located (install dir)
type following command to start apache
bin/apachectl start
bin/apachectl stop (this stops apache)
bin/apachectl graceful (this restarts apache)
0
 
LVL 5

Author Comment

by:Peewee
Comment Utility
vipulgupta,
when i check status it tells me that apache is running.

however, when i open my browser and type localhost it cannot find localhost.

how do i check thats it up ok

regards
peewee
0
 
LVL 2

Expert Comment

by:vipulgupta
Comment Utility
Increase points first
0
 
LVL 5

Author Comment

by:Peewee
Comment Utility
blimey u drive a hard bargain!

regards
Peewee
0
 
LVL 15

Expert Comment

by:samri
Comment Utility
Could you check whether the httpd daemon is running or not.  Perhaps a "ps -aef | grep httpd" would give a listing of the running apache process.  

Next, try to do a simple "telnet localhost 80", and is whether the process is running OK or not.

--example my apache is listening on port 8000
myserver% telnet localhost 80
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
myserver% telnet localhost 8000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

------

Otherwiser, look in the startup script (I'm not sure about mandrake), but on Solaris, loook in /etc/init.d/.  There should be a startup file for apache.

/etc/init.d/apache start <-- will start
/etc/init.d/apache stop <-- will bring down.

0
 
LVL 5

Author Comment

by:Peewee
Comment Utility
samri,
ok when i execute the ps - aef | grep httpd i get ten rows reurned. Five are as follows:

httpd-perl -f /etc/httpd/conf

five are as follows:
DPERLPROXIED -DHAVE_SSL

hence i believe the server is up.  When i type whereis apachectl it returns /usr/sbin/apacahectl.

when i try apachectl status in the above directory it returns httpd-perl and the ssl row as running.  When i try apachectl extended status it returns cant connect to localhost 8200 statup file.

when i attempt to telnet localhost 80 it returns:
127 etc trying
telnet: unable to connect to remote host network is unreachable

phew!

nay ideas
regards
Peewee
0
 
LVL 15

Expert Comment

by:samri
Comment Utility
Peewee,

I suspected that your apache must be running on port different than 80.  Kindly check you apache config file, I believe it is in /etc/apache.conf, or httpd.conf.

Look in the config file for "Listen" or "Port" keywords.

Based on your explanation, you might be running the server on SSL port (443).  Try "telnet localhost 443"

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
Listen 80

#
# Port: The port to which the standalone server listens. For
# ports < 1023, you will need httpd to be run as root initially.
#
#Port 80


And back to original question, any operation can be done via apachectl command

# /usr/sbin/apachectl help
usage: /usr/local/apache/bin/apachectl (start|stop|restart|fullstatus|status|gra
ceful|configtest|help)

start      - start httpd
stop       - stop httpd
restart    - restart httpd if running by sending a SIGHUP or start if
             not running
fullstatus - dump a full status screen; requires lynx and mod_status enabled
status     - dump a short status screen; requires lynx and mod_status enabled
graceful   - do a graceful restart by sending a SIGUSR1 or start if not running
configtest - do a configuration syntax test
help       - this screen    
0
 
LVL 15

Expert Comment

by:samri
Comment Utility
Peewee,

I suspected that your apache must be running on port different than 80.  Kindly check you apache config file, I believe it is in /etc/apache.conf, or httpd.conf.

Look in the config file for "Listen" or "Port" keywords.

Based on your explanation, you might be running the server on SSL port (443).  Try "telnet localhost 443"

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
Listen 80

#
# Port: The port to which the standalone server listens. For
# ports < 1023, you will need httpd to be run as root initially.
#
#Port 80


And back to original question, any operation can be done via apachectl command

# /usr/sbin/apachectl help
usage: /usr/local/apache/bin/apachectl (start|stop|restart|fullstatus|status|gra
ceful|configtest|help)

start      - start httpd
stop       - stop httpd
restart    - restart httpd if running by sending a SIGHUP or start if
             not running
fullstatus - dump a full status screen; requires lynx and mod_status enabled
status     - dump a short status screen; requires lynx and mod_status enabled
graceful   - do a graceful restart by sending a SIGUSR1 or start if not running
configtest - do a configuration syntax test
help       - this screen    
0
 
LVL 15

Expert Comment

by:samri
Comment Utility
sorry for the duplicate post.
0
 
LVL 15

Accepted Solution

by:
samri earned 50 total points
Comment Utility
Peewee,

I suspected that your apache must be running on port different than 80.  Kindly check you apache config file, I believe it is in /etc/apache.conf, or httpd.conf.

Look in the config file for "Listen" or "Port" keywords.

Based on your explanation, you might be running the server on SSL port (443).  Try "telnet localhost 443"

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
Listen 80

#
# Port: The port to which the standalone server listens. For
# ports < 1023, you will need httpd to be run as root initially.
#
#Port 80


And back to original question, any operation can be done via apachectl command

# /usr/sbin/apachectl help
usage: /usr/local/apache/bin/apachectl (start|stop|restart|fullstatus|status|gra
ceful|configtest|help)

start      - start httpd
stop       - stop httpd
restart    - restart httpd if running by sending a SIGHUP or start if
             not running
fullstatus - dump a full status screen; requires lynx and mod_status enabled
status     - dump a short status screen; requires lynx and mod_status enabled
graceful   - do a graceful restart by sending a SIGUSR1 or start if not running
configtest - do a configuration syntax test
help       - this screen    
0
 
LVL 5

Author Comment

by:Peewee
Comment Utility
samri,
i've tried telnet on port 80, 8080 and 443.  But i still get the trying and then cant connect to remote host message, though the apachectl status tells me that the server is up and running.

regards
Peewee

0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 
LVL 5

Author Comment

by:Peewee
Comment Utility
samri,
shouldn't it be trying to connect to local host not remote host, ie the error message syas cant connect to remote host!
0
 
LVL 5

Author Comment

by:Peewee
Comment Utility
samri,
shouldn't it be trying to connect to local host not remote host, ie the error message syas cant connect to remote host!
0
 
LVL 15

Expert Comment

by:samri
Comment Utility
Peewee,

My apologies on the repeated posts.

Yes you are right... somehow if the connection fails, the error message seems to be misleading.

Unable to connect to remote host !

kinda of dumb.

You have tried to "telnet localhost 80" or even 443, and it still not responding.  Very strange.  How about the server logs (access_log and error_log) anything weird ?

What port does it listen to in httpd.conf

0
 
LVL 5

Author Comment

by:Peewee
Comment Utility
samri,
the access log just shows start up ans then shutdown, there's nothing in the error log.

port 80 is specified in httpd.conf

regards
peewee
0
 
LVL 15

Expert Comment

by:samri
Comment Utility
Peewee,

I'm almost as exhausted as you are.

one more thing to check:  Is the firewall configured on the machine.  If it is, is it running OK.

Btw, have you checked from other machine on the network, and see if they can see you.

How about "telnet <your-ip-address> 80", and not telnet localhost 80,  does this works.
0
 
LVL 5

Author Comment

by:Peewee
Comment Utility
samri,
ok, i've taken drastic action here.  I've unistalled all the apache packages i installed with rpm AND I'VE OBTAINED a 1.3.9.tar.gz from www.apache.org.

i've tarred it and gunzippeed it, and used make, make install to install this version.

With this version, any of the apachectl command returns the error previous message 'cant connect to remote host'.

any ideas
regards
Peewee
0
 
LVL 15

Expert Comment

by:samri
Comment Utility
Peewee,

by default, apache will be in /usr/local/apache.  apachectl will be in /usr/local/apache/bin

Try running the full path : /usr/local/bin/apachectl start

Btw,  make sure you issue a ./configure in the apache source tree before doing a make.

0
 
LVL 15

Expert Comment

by:samri
Comment Utility
Peewee

so... what is the status?
0
 

Expert Comment

by:EarWig
Comment Utility
What do you see when you type your apache host's name in your browser?  If Apache is listening on port 80 in your httpd.conf, then you won't need to append the port to the host name..Also if the httpd deamon is running but you can't access the Apache start page via your browser, check the error log in the logs directory in your Apache install dir.
0
 
LVL 5

Author Comment

by:Peewee
Comment Utility
chaps,
i'm on holiday in Thailand at the moment. I wont be back until 14th of september; i'll pick this up then..

bye for now

peewee
0
 
LVL 1

Expert Comment

by:larry718
Comment Utility
Give this a shot...

httpd.conf
=======================================
servername localhost

uncomment it!
0
 
LVL 5

Author Comment

by:Peewee
Comment Utility
Samri,
i've managed to sort the problem by re-installing apache and linux itself.  It seems the problem was linked to the linux installation which was within a windows partition..

i awarded you the points as these comments were most helpful, and you were most keen to help me out.

many thanks
peewee
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now