Ubuntu virtual machine to build a web server

First install the apache service

sudo apt-get install apache2

Open the browser, enter localhost in the address bar, the following interface is displayed, indicating that the installation is successful.
Ubuntu virtual machine to build a web server
Since Ubuntu comes with php7.0 version, and we need php5.6 version, we need to switch to php5.6 version

*sudo add-apt-repository ppa:ondrej/php #Add source

sudo apt-get update #install php5.6

sudo apt-get install php5.6

sudo apt-get install libapache2-mod-php5.6

sudo apt-get install php5.6-mysql php5.6-mbstring php5.6-mcrypt php5.6-xml

sudo a2dismod php7.0 #Switch version

sudo a2enmod php5.6

sudo service apache2 restartupdate-alternatives --set php /usr/bin/php5.6*

Enter php -v to view the current php version.

install mysql service

sudo apt-get install mysql-server mysql-client

**Restart apache service /etc/init.d/apache2 restart

Need to reconfigure phpmyadmin to manage mysql database**

sudo dpkg-reconfigure phpmyadmin

Switch to the /var/www/html directory, which is the default document of apache, create an info.php in the current folder and write <?php phpinfo() ?> Then open localhost/info.php in the browser to view the current configuration information.

Open the browser, enter /localhost/phpmyadmin to manage the mysql database, the account is root, and the password is the password when mysql was just installed. At this point, the server setup is complete.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325237853&siteId=291194637