[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

How do i start up apache in linux?

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
Peewee
Asked:
Peewee
  • 10
  • 9
  • 2
  • +2
1 Solution
 
vipulguptaCommented:
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
 
PeeweeAuthor Commented:
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
 
vipulguptaCommented:
Increase points first
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
PeeweeAuthor Commented:
blimey u drive a hard bargain!

regards
Peewee
0
 
samriCommented:
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
 
PeeweeAuthor Commented:
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
 
samriCommented:
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
 
samriCommented:
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
 
samriCommented:
sorry for the duplicate post.
0
 
samriCommented:
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
 
PeeweeAuthor Commented:
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
 
PeeweeAuthor Commented:
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
 
PeeweeAuthor Commented:
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
 
samriCommented:
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
 
PeeweeAuthor Commented:
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
 
samriCommented:
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
 
PeeweeAuthor Commented:
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
 
samriCommented:
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
 
samriCommented:
Peewee

so... what is the status?
0
 
EarWigCommented:
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
 
PeeweeAuthor Commented:
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
 
larry718Commented:
Give this a shot...

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

uncomment it!
0
 
PeeweeAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 10
  • 9
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now