Apache2
Contents
Installation
Installing Apache2
In order to use apache2 web server, you should install it before. In Linux Debian/Ubuntu OS:
sudo apt-get install apache2
If you intend to upload a website which script includes PHP language to your Apache Server, you should install both PHP and its related modules for apache2:
sudo apt-get install php libapache2-mod-php
Other modules may be added the same way. For short, if you encounter any trouble you may install every PHP module:
sudo apt-get install php-all-dev
If you intend to set a MYSQL Server on your apache-served website, you should install it before:
sudo apt-get install mysql-server
As well as the MYSQL PHP-related module:
sudo apt-get install php-mysql
Example of use
To test your websites on your local machine, you may add the following line to the /etc/apache2/apache2.conf file:
ServerName localhost
Copy your website files to the /var/www/ directory:
sudo cp -r <WEBSITE_ROOT_DIR_PATH> /var/www/
Also, it's important to change the default document root path in the /etc/apache2/sites-available/000-default.conf file to:
DocumentRoot /var/www/
And reload the apache2 service:
sudo service apache2 reload
Now you can check your website opening a web browser and accesing the address localhost/<WEBSITE_ROOT_DIR_NAME>.