Arch Linux Web & Mail Server (Part 1)
23/11/2010After wondering how difficult it would be to configure my own web server that could also handle mail, I decided to start a small project at home involving my desktop. I wanted to see if I could replicate the servers that I currently use to host this site, but on a much smaller scale in terms of hardware. Until now, I didn’t realize how simple it was to actually configure a server with apache, mysql, php, and roundcube (for webmail).
This post will cover how I configured my Arch linux desktop to function as a web server and webmail server. Arch linux has provided a detailed guide that was used and helped out greatly. Although it proved a great help, this post is a summary of it and a few other miscellaneous articles.
The basic requirements for a linux box to function as a web server are apache, sql and php. In Arch linux, you can install the required packages using the following command:
|
1 |
# pacman -S apache php php-apache mysql |
Next, you will need to configure a couple of things. (Most of the packages come pre-configured, however, you will just need to verify the configuration.) First, you need to make sure that your ‘HOSTNAME’ configurations match in both /etc/rc.conf and /etc/hosts.
Next, you will need to comment the following line in /etc/httpd/conf/httpd.conf (should be around line 91).
|
1 |
LoadModule unique_id_module modules/mod_unique_id.so |
At the end of the LoadModule section (around line 121) add the following:
|
1 |
LoadModule php5_module modules/libphp5.so |
and add this line to the end of the Include section (around line 473):
|
1 |
Include conf/extra/php5_module.conf |
This will get the basic functions in place to start your Apache server running PHP. This is in no way a secure setup, and you will need to make any additional changes to your httpd.conf and other security files to make your system more secure. To test your install, first start your services with:
# /etc/rc.d/httpd start
and then you need to make a simple index.php file in ‘/srv/http/’ and point your browser to http://localhost/.
A good example for a PHP page is the following:
|
1 2 3 4 5 6 7 8 9 10 |
<html> <head> <title>Hello World</title> </head> <center> <?php Print "Hello, World!"; ?> </center> </html> |
The Next section will cover mysql, myphpadmin and roundcube webmail server setup.