Skip to content

Instantly share code, notes, and snippets.

@thanhhaiqtvn
Last active August 29, 2018 06:31
Show Gist options
  • Save thanhhaiqtvn/bb44fad108edb94dbeeb0d5479c636dc to your computer and use it in GitHub Desktop.
Save thanhhaiqtvn/bb44fad108edb94dbeeb0d5479c636dc to your computer and use it in GitHub Desktop.
Command Linux

Command Ubuntu

Add new users to EC2 and give SSH Key access

create a new user using the following command:

sudo adduser haidoan

Next, we switch the shell session to the new account:

sudo su haidoan

Create .ssh directory, and change the directory permission to 700 (only the file owner can read, write or open the directory):

mkdir .ssh
chmod 700 .ssh

Create an empty file called authorized_keys in the .ssh directory and change its permissions to 600 (only the file owner can read or writ eto the file)

touch authorized_keys
chmod 600 authorized_keys

Finally, edit the authorized_keys file and paste in your public key. We now are logged in as user haidoan

Add new Website

mkdir -p /var/www/ihadas.com/{public_html,logs,backup}

Config nignx

server {
    listen 80;
    listen [::]:80;
    root /var/www/ihadas.com/public_html;
    index index.php index.html index.htm;
    server_name  ihadas.com www.ihadas.com;

    access_log /var/www/ihadas.com/logs/access.log;
    error_log /var/www/ihadas.com/logs/error.log;

    location / {
        try_files $uri $uri/ /index.php?$query_string;    
    }

  
    # pass PHP scripts to FastCGI server
    #
    location ~ \.php$ {
        #include fastcgi_params;
        include snippets/fastcgi-php.conf;
        
        # With php-fpm (or other unix sockets):
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        
        # With php-cgi (or other tcp sockets):
        #fastcgi_pass 127.0.0.1:9000;
    }

    location ~ /\.ht {
        deny all;
    }
}

=============================================================

check múi giờ Linux

– Kiểm tra múi giờ hiện tại:

date

– Cập nhật lại timezone sang Asia/Ho_Chi_Minh:

rm -f /etc/localtime

ln -s /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime

=============================================================

  1. Kiểm tra dung lượng ổ cứng mà các file hệ thống sử dụng.
[root@vultr ~]# df
  1. Hiện thị thông tin ổ đĩa các file hệ thống sử dụng
[root@vultr ~]# df -a
  1. Hiển thị dung lượng đĩa sử dụng dạng MB và GB
[root@vultr ~]# df -h
  1. Hiện thị thông tin về thư mục Home
[root@vultr ~]# df -hT /home
  1. Hiển thị thông tin về các file hệ thống theo bytes
[root@vultr ~]# df -k
  1. Xem thông tin file hệ thống ở MB
[root@vultr ~]# df -m
  1. Xem thông tin file hệ thống ở GB
[root@vultr ~]# df -h
  1. Xem thông tin Inodes
[root@vultr ~]# df -i
  1. Hiển thị thông tin định dạng file hệ thống
[root@vultr ~]# df -T
  1. Xem các lệnh df
[root@vultr ~]#  df --help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment