AT-PHPIntership / server-practice

0 stars 2 forks source link

S2-Tran Thong #16

Open ghost opened 6 years ago

ghost commented 6 years ago

Các lệnh về vagrant

vagrant box

list boxes

vagrant box list

List các box trong máy PC. Hình ảnh: screenshot from 2018-06-18 03-54-52

add box

vagrant box add <name-box>

Thêm mới box mới. Hình ảnh: screenshot from 2018-06-18 04-38-24

remove box

vagrant box remove <name-box>

Remove một box trong PC. Hình ảnh: screenshot from 2018-06-18 04-43-23

export box

vagrant package --base <box-name> --output <position-save>

Xuất ra file cấu hình có trong máy PC Hình ảnh: screenshot from 2018-06-18 04-46-59

vagrant plugins

install plugin

vagrant plugin install <name-plugin>

cài đặt plugin. Hình ảnh: screenshot from 2018-06-18 04-47-35

list plugin

vagrant plugin list

List các plugin trong PC. Hình ảnh: screenshot from 2018-06-18 04-48-02

uninstall plugin

vagrant plugin uninstall <name-plugin>

Xóa các plugin trong PC. Hình ảnh: screenshot from 2018-06-18 04-48-41

vagrant

vagrant start

vagrant up

Add box vào virtual box. Hình ảnh: screenshot from 2018-06-18 04-49-26

vagrant stop

vagrant halt

Dừng vagrant. Hình ảnh: screenshot from 2018-06-18 04-49-58

vagrant reload

vagrant reload

Reload lại nếu cấu hình có thay đổi. Hình ảnh: screenshot from 2018-06-18 04-50-31

Vagrant provision

vagrant provison

Kiểm tra các điều khoản Hình ảnh: screenshot from 2018-06-18 04-53-10

config.vm.box

Tên của box.

config.vm.network "forwarded_port"

Máy thực và máy ảo liên lạc qua cổng nào.

config.vm.network "private_network"

cấu hình địa chỉ IP local.

config.vm.network "public_network"

Cấu hình địa chỉ IP public.

config.vm.synced_folder

Đồng bộ file

config.vm.provider

Thông tin nhà cung cấp mở được box.

Cài đặt web server

Install apache

sudo apt-get install apache2

Hình ảnh: screenshot from 2018-06-18 05-01-36 Vào trình duyệt 192.168.33.10 screenshot from 2018-06-18 05-02-58

Install PHP

sudo apt install php7.2-mysql php7.2 php7.2-cli

Hình ảnh: screenshot from 2018-06-18 05-13-38

Install mysql

sudo apt install mysql-server

Hình ảnh: screenshot from 2018-06-18 04-56-50

php hello world

Vào file /var/www/html tạo index.php có nội dung như sau

<?php
echo "Hello World";
?>

Hình ảnh: screenshot from 2018-06-18 05-05-37

Vào trình duyệt gõ địa chỉ 192.168.33.10

screenshot from 2018-06-18 05-14-57

php phpinfo()

Vào file /var/www/html tạo index.php có nội dung như sau

<?php
phpinfo();
?>

Vào trình duyệt gõ địa chỉ 192.168.33.10 screenshot from 2018-06-18 05-16-10

Config vhost

Kết nối tới mysql từ terminal, từ workbench

Kết nối tới mysql từ terminal

sudo mysql -u -p root

screenshot from 2018-06-18 05-38-34

Kết nối tới mysql từ workbench

screenshot from 2018-06-18 06-03-13

ghost commented 6 years ago

LGTM. thanks