Login as root user and type the following commands:
Task: Start httpd server:
# service httpd start
Task: Restart httpd server:
# service httpd restart
Task: Stop httpd server:
# service httpd stop
Please note that restart option is a shorthand way of stopping and then starting the Apache HTTPd Server. You need to restart server whenever you make changes to httpd.conf file. It is also good idea to check configuration error before typing restart option:# httpd -t
# httpd -t -D DUMP_VHOSTS
Sample output:
Syntax OK
Now restart httpd server:# service httpd restart
Where,
- -t : Run syntax check for config files
- -t -D DUMP_VHOSTS : Run syntax check for config files and show parsed settings only for vhost.
/etc/init.d/httpd script
You can also use following command:# /etc/init.d/httpd restart
# /etc/init.d/httpd start
# /etc/init.d/httpd stop
A note about Debian / Ubuntu Linux
Type the following command under Debian / Ubuntu Linux:# /etc/init.d/apache2 restart
# /etc/init.d/apache2 stop
# /etc/init.d/apache2 start# service apache2 restart
# service apache2 stop
# service apache2 start