############################################################ Configuring Apache2 on Shunya OS ############################################################ Getting Started =============== Installation ------------- To install apache2 run the following command: .. code-block:: shell sudo opkg install apache2 Configuration ============== Apache2 configuration files are located in **/etc/apache2/httpd.conf**. Apache2 server root is located in **/usr/share/apache2/htdocs/** Configuring apache2 for php --------------------------- For using php with apache2 you need to install the following modules: php php-modphp **This can be done through the following command** **Step 1:Installing necessary modules** .. code-block:: shell sudo opkg install php php-modphp **Step 2:Write a php script in /usr/share/apache2/htdocs/** For testing purpose we created a minimal file /usr/share/apache2/htdocs/index.php **The test .php file contains a single line:** .. code-block:: php **Step 3:Restart apache2 server** .. code-block:: shell systemctl restart apache2 **Step 4:Test** To test this on the browser type the following in the URL: localhost/filename.php (in our case it was localhost/index.php) Configuring virtual-host for apache2 ------------------------------------ virtual-host allow users to use same ip address for different domain names. Let us take an example. Suppose we want to have 2 domain names called test.com and example.com on the same ip, the following steps will help us illustrate how virtual-hosts are achieved on Shunya-Os. **Step 1:Create 2 webpages** .. code-block:: shell cd /usr/share/apache2/htdocs sudo mkdir -p example.com/public_html test.com/public_html sudo chown -R shunya:shunya example.com/public_html test.com/public_html sudo chmod -R 755 /usr/share/apache2/htdocs gedit example.com/public_html/index.html .. code-block:: html