Apache

From gr0x0rd
Jump to navigation Jump to search

Installing apache

Apache is the most commonly used web server in the linux world. There are alternatives such as lighttpd and spin-offs such as tomcat; this guide focuses on plan old apache using php and mySQL, otherwise known as a LAMP server (Linux-Apache-mySQL-php).

Before you begin, check that your /etc/portage/package.use file contains the php and mysql USE flags if they aren't in your /etc/make.conf.

$ sudo emerge -av apache

Once the emerge completes, we'll need to set the ServerName directive before we can start the server successfully.

$ sudo nano -w /etc/apache2/httpd.conf

Make sure the file contains the following directive:

ServerName yourserversname

Let's start apache with the system

$ sudo rc-update add apache2 default

And start the server

$ sudo /etc/init.d/apache2 start

You'll also want to add any user accounts desired to the apache group.

$ sudo usermod -a -G apache username

The default location for your web root is /var/www/localhost/htdocs/. To be sure your apache server is up and running, if you visit http://localhost , you should see a simple page with black text saying, "It works!"

Apache tips

To restart the apache server after a configuration change without interrupting service, enter the command

$ sudo /etc/init.d/apache2 graceful