Solved

How do i start up apache in linux?

Posted on 2001-08-07
23
311 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
ID: 6361288
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
ID: 6361651
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
ID: 6365659
Increase points first
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 5

Author Comment

by:Peewee
ID: 6366063
blimey u drive a hard bargain!

regards
Peewee
0
 
LVL 15

Expert Comment

by:samri
ID: 6366867
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
ID: 6367674
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
ID: 6371026
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
ID: 6371031
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
ID: 6371033
sorry for the duplicate post.
0
 
LVL 15

Accepted Solution

by:
samri earned 50 total points
ID: 6371041
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
ID: 6371996
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
 
LVL 5

Author Comment

by:Peewee
ID: 6372004
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
ID: 6372005
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
ID: 6373230
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
ID: 6373473
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
ID: 6375878
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
ID: 6377550
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
ID: 6379009
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
ID: 6391741
Peewee

so... what is the status?
0
 

Expert Comment

by:EarWig
ID: 6392279
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
ID: 6399885
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
ID: 6407292
Give this a shot...

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

uncomment it!
0
 
LVL 5

Author Comment

by:Peewee
ID: 6502767
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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