官术网_书友最值得收藏!

Deploying LAMP stack using GCE

Let's explore how we would set up a LAMP stack on a VM instance. LAMP is a stack of Linux, Apache, MySQL, and PHP:

  1. Connect to your Linux VM instance using SSH and update it. We will follow Debian 9 commands throughout this example:
sudo apt-get update 
  1. Install Apache 2's PHP module:
sudo apt-get install libapache2-mod-php php  
  1. To test the installation, enter your external IP address and you should see the Apache test page. You can copy the external IP from the list on the console page of VM instances. It should show the Apache starting page:
http://[EXTERNAL_IP]
  1. To verify that PHP and Apache are working together, edit the phpinfo.php file and access it with your VM instance external IP:
sudo sh -c 'echo "[YOUR_PHP_CODE]" > /var/www/html/phpinfo.php'
http://[YOUR_EXTERNAL_IP_ADDRESS]/phpinfo.php  
  1. If it fails, you will receive a 404 error.
  2. Finally, to install MySQL and relevant components, use the following command:
sudo apt-get install mysql-server php5-mysql php-pear  
  1. You now have a complete Linux, Apache, MySQL, PHP (LAMP) stack.
主站蜘蛛池模板: 湘阴县| 崇礼县| 井陉县| 安仁县| 巴彦淖尔市| 静宁县| 棋牌| 抚松县| 梓潼县| 德钦县| 庄浪县| 武强县| 通化县| 刚察县| 大连市| 青田县| 明水县| 牡丹江市| 界首市| 新沂市| 乌拉特中旗| 武平县| 亳州市| 徐汇区| 民和| 乌兰察布市| 济南市| 新巴尔虎右旗| 贵州省| 内乡县| 顺义区| 菏泽市| 疏附县| 定南县| 乌苏市| 合肥市| 靖边县| 通化市| 尼木县| 巴林左旗| 兴业县|