How do I start, restart or stop Apache 2 web server under Ubuntu Linux operating systems?
/etc/init.d/apache2 is service script used to start / stop / restart the Apache2 service under Debian or Ubuntu Linux. You need to login as root or use sudo command restart Apache.
Task: Start Apache 2 Server
# /etc/init.d/apache2 start
or
$ sudo /etc/init.d/apache2 start
Task: Restart Apache 2 Server
# /etc/init.d/apache2 restart
or
$ sudo /etc/init.d/apache2 restart
Task: Stop Apache 2 Server
# /etc/init.d/apache2 stop
or
$ sudo /etc/init.d/apache2 stop
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop





![Apache: [warn] _default_ VirtualHost overlap on port 80, the first has precedence Error and Solution](http://s13.cyberciti.org/images/shared/rp/3/20.jpg)








{ 17 comments… read them below or add one }
Edit ~/.bash_profile and add:
alias apache='sudo /etc/init.d/apache2'Then it’s just apache start, apache restart, etc.
Thanks for the tip. It worked like a charm.
thanks man
These cmd line works great!!!!
Here is what works for me:
/etc/rc.d/init.d/httpd (space) start
or
/etc/rc.d/init.d/httpd (space) stop
nice tutorials,
is there a way to run the apache server as services just like in xampp?
Thanks,
man
wohooooooo,,,, good tutorial ,,, 4 thumbs ^_^
it s not workin for me….
the result is
sudo: /etc/init.d/apache2 commad not found
pls help me guys
sudo /etc/init.d/apache2 do not put that column after sudo
i has stop my apache server, but another connections still establish
unix 3 [ ] STREAM CONNECTED 14940 /tmp/orbit-username/
I’m from Brazil, and your tip helped me a lot, thanks!
sudo service apache2 restart
Thanks mate! nice and easy ( I like the easy ones!)
awesome site………
Thanks for the help.
the amount of times i forget this. sheesh. thanks gzip
Hi! this tutorial is great. things have been ok but mine didnt work at the configuration stage. i restart the server but this d response:
Restarting web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
… waiting apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
help me pls