Category: Linux
Apache2 + PHP + SQL + phpMyAdmin + Virtual Hosts in Ubuntu 16.04
This post describes how to install the web server. Each component will be installed separately. It also describes how to configure virtual hosts.
First, install Apache from the repository:
sudo apt install apache2
Start, stop, and status check is performed by using the commands:
sudo /etc/init.d/apache2 start
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 status
Create a directory where the site will be located:
sudo mkdir /var/www/cms.test
Assign the owner and set the rights to the directory:
sudo chown -R user:group /var/www
sudo chmod -R 755 /var/www
Create a virtual host configuration:
sudo nano /etc/apache2/sites-available/cms.test.conf
Put in the following config:
<VirtualHost *:80>
ServerAdmin admin@cms.test
ServerName cms.test
ServerAlias www.cms.test
DocumentRoot /var/www/cms.test
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
After saving, add the host from sites-available to sites-enabled:
sudo a2ensite cms.site.conf
Reboot the server configuration and the server:
sudo /etc/init.d/apache2 reload
sudo /etc/init.d/apache2 restart
In order to make the created domain visible from the network, you need to add it to the hosts file.
To edit the file:
sudo nano /etc/hosts
Inside it insert:
127.0.0.1 cms.test
After saving, you must restart the Apache server to see the new host.
Install PHP:
sudo apt install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0
Install the database server:
sudo apt install mariadb-server mariadb-client
After installation, you need to configure by running the script:
sudo mysql_secure_installation
Install phpMyAdmin:
sudo apt install phpmyadmin
Answer the questions that the script asks.
Next, you need to disable protection in the database, which does not allow to connect as root to the server. To do this, login root and run in terminal:
echo "update user set plugin='' where User='root'; flush privileges;" | mysql -u root -p mysql
If you open http://localhost/phpmyadmin/ you have an error on mbsting, execute:
sudo apt install php7.0-mbstring
sudo apt install libapache2-mod-php7.0
In /etc/php/7.0/apache2/php.ini you need to remove the comment in the line:
extension=php_mbstring.dll
Example:
The web server configuration is complete.
Posted: 2017-02-23
2021-12-20 01:21:47
Anthonysuser
However, there is absolutely no online casino play allowed across state lines. <a href=https://largetrue.org/most-read/32246-poslednite_kazino_bonus_ot>Невада разрешава настаняване с домашни любимци</a> The casino features 86 slot machines and 12 gaming tables. <a href=https://largetrue.org/most-read/23076-kakto_vinagi_poluchavane_na>храна до живото казино Филаделфия</a> IGT’s Miss Red best mobile slots game is characterized by 1024 ways to win. <a href=https://largetrue.org/most-read/36381-ima_li_kazino_v_blizost_do>рейтинг казино ni no kuni</a> In fact, there are lots of online slots that are free to perform solitario spider directly from your computer. Bonus Code - 851e86a930ac5844811e8a426f31c2e3