MIx Conf
-
Installing Apache
$ sudo apt-get update && apt-get install apache2
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod dir
sudo a2enmod env
sudo a2enmod mime
sudo systemctl restart apache2
PHP
sudo apt-get install -y php php-mysql libapache2-mod-php
sudo apt-get install -y php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip php-sqlite3
create a new file in # cd /var/www/html/
sudo vim /var/www/html/info.php
<?php phpinfo();
http://your_ip/info.php
# sudo rm /var/www/html/info.php
INSTALL PHP MODULES
To find the details of any particular php module, for example php-gd, run:
# sudo apt-cache search php- | less
# sudo apt-cache show php-gd
To install a php module run:
# sudo apt install php-gd
To install all modules (not necessary though), run:
# sudo apt-get install php*
sudo vim /etc/apache2/mods-enabled/dir.conf
Make sure index.php is defined as a DirectoryIndex in the dir.conf file…
<IfModule mod_dir.c> DirectoryIndex index.html index.php index.xhtml index.htm </IfModule>
Next, configure your domain or server name for your site… Open Apache2 default site config file by running the commands below.
sudo vim /etc/apache2/sites-enabled/000-default.conf
Then add the ServerName and ServerAlias to match your domain name… and save the file.
<VirtualHost *:80> ServerAdmin admin@mylab.com DocumentRoot /var/www/html/ ServerName example.com ServerAlias example.com ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
After that restart Apache2.
sudo systemctl restart apache2.service
-------