Apache a powerful and the most popular web server. It makes a great choice for anything from a powerful production server to a small personal home server. It is often installed as part of LAMP web service solution stack.
Install Apache Web Server
Install from the official repository.
sudo pacman -S apache
Configure Apache Web Server
Open the configuration file.
sudo nano /etc/httpd/conf/httpd.conf
Default port is
80 and can be modified with
Listen option. Default user and group are set to
http and can be changed with
Group options respectively. Administrator email address is defines with
ServerAdmin option. The default location where the web pages are accessed from is
/srv/http. This value can be changed with
DocumentRoot option in which case
<Directory> values should also be changed appropriately.
Optionally modules can also be enabled by uncommenting relevant lines.
#LoadModule rewrite_module modules/mod_rewrite.so
Copy the directory directive changing the options and values as needed. Each directory or sub-directory can have it’s own directive with distinct settings.
<Directory "/mnt/web"> AllowOverride All Options Indexes FollowSymLinks </Directory>
<Directory> tags options can be added that are specific to that directory or all directories if the path is not specified.
Options directive can be used to define options like
Indexes which allows listing of directories and files or
FollowSymLinks which allows symbolic links. If
.htaccess files are to be used
AllowOverride should be should be set to
All otherwise value of
None is recommended.
DocumentRoot option was changed to a new directory then create it to store website files.
sudo mkdir /mnt/web
Change the owner and group of the document root directory.
sudo chown -R http:http /mnt/web
Change the permissions of the document root directory.
sudo chmod -R 775 /mnt/virtual/web
Start Apache Web Server
Start the service.
sudo systemctl start httpd
Enable the service to run at boot.
sudo systemctl enable httpd
Once successfully installed it may be desirable to configure Apache user passwords to prevent unauthorized access to the server. To complete the LAMP server also install MySQL / MariaDB and install PHP. Optionally also install phpMyAdmin.