Skip to content

Instantly share code, notes, and snippets.

View codedeep79's full-sized avatar

Nguyễn Trung Hậu codedeep79

View GitHub Profile
@codedeep79
codedeep79 / 7 useful VSCode extensions for a PHP developer.md
Last active August 3, 2022 08:08
7 useful VSCode extensions for a PHP developer

Here are 7 VScode extensions which will help you to make the best use of VScode if you are a PHP developer:

PHP Tools This is an all-in-one extension. This extension provides all the needed development configuration for PHP developers like fast code completion, code fixes, code lenses, code generators, debugger, built-in development web server, test explorer, tests debugger, and workspace-wide code analysis.

Laravel Snippets It supports Laravel 5.x-9.x.

@codedeep79
codedeep79 / Cài đặt Linux, Apache, MySQL, PHP (LAMP) trong Ubuntu.md
Last active August 24, 2022 03:32
Cài đặt Linux, Apache, MySQL, PHP (LAMP) trong Ubuntu

Step 1 — Installing Apache and Updating the Firewall

Updating the package manager cache and install Apache:

sudo apt update
sudo apt install apache2

Once the installation is finished, you’ll need to adjust your firewall settings to allow HTTP traffic. To list all currently available UFW application profiles, you can run:

@codedeep79
codedeep79 / Enable apache2's default website.md
Created July 25, 2022 06:22
Enable apache2's default website
sudo a2ensite 000-default
systemctl reload apache2
grep -R "DocumentRoot" /etc/apache2/sites-enabled

@codedeep79
codedeep79 / Change MySQL Password Policy Level.md
Last active July 25, 2022 11:54
Change MySQL Password Policy Level

The latest MySQL servers come with a validate password plugin. This plugin configures a password policy to make MySQL server more secure. While changing the password, I got the error: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

  • Login to MySQL command prompt: mysql -h localhost -u root -p
  • Execute query to view current settings of validate_password: SHOW VARIABLES LIKE 'validate_password%';

The default level is MEDIUM, we can change it to LOW by using the below query. The LOW level required only password’s length to min 8 characters: mysql> SET GLOBAL validate_password.policy=LOW;

@codedeep79
codedeep79 / Uninstall LAMP Stack in Ubuntu.md
Last active July 25, 2022 11:08
Uninstall LAMP Stack in Ubuntu

To uninstall PHP

sudo apt-get remove --purge php*
sudo apt-get purge php*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-php
sudo apt-get dist-upgrade

Note: The output of the below command will provide you with information the installed package software, version, architecture and short description about the package

@codedeep79
codedeep79 / Install Linux, Nginx, MySQL, PHP (LEMP stack) on Ubuntu 22.04.md
Last active August 3, 2022 08:07
Install Linux, Nginx, MySQL, PHP (LEMP stack) on Ubuntu 22.04

Step 1 – Installing the Nginx Web Server

sudo apt update
sudo apt install nginx

When prompted, press Y and ENTER to confirm that you want to install Nginx. Once the installation is finished, the Nginx web server will be active and running on your Ubuntu 22.04 server. Nginx registers a few different UFW application profiles upon installation. To check which UFW profiles are available, run: sudo ufw app list Configure HTTP traffic on port 80: sudo ufw allow 'Nginx HTTP'

@codedeep79
codedeep79 / Kiểm tra trạng thái hoạt động của Nginx.md
Last active July 25, 2022 21:18
Kiểm tra trạng thái hoạt động của Nginx

Nginx is an open-source, freely available web server that can be utilized for video streaming, caching, load balancing, reverse proxy, and other applications.

Enabling Nginx on Ubuntu system: sudo systemctl enable nginx

After that, start the Nginx service: sudo systemctl start nginx

Check Nginx status using systemctl:

  • You can execute systemctl command for checking the Nginx status: sudo systemctl status nginx
@codedeep79
codedeep79 / Phân tích nhật ký truy cập log của Nginx.md
Last active July 26, 2022 02:36
Phân tích nhật ký truy cập (log) của Nginx

If you want to optimize your web server, it is essential to understand Nginx access logs. Nginx access logs comprise detailed information about the access requests of the users. Your Nginx access logs are saved in the "/var/log" directory, executing the below-given command will parse Nginx access logs to retrieve a list of the IP addresses of the users that have been accessed in the log file:

sudo cat /var/log/nginx/access.log | awk '{ print $1}' | sort | uniq -c | sort

Parse Nginx access logs for getting accessed file list:

@codedeep79
codedeep79 / Install IntelliJ IDEA on Ubuntu Linux Desktop.md
Last active August 11, 2022 03:45
Install IntelliJ IDEA on Ubuntu Linux Desktop

Prerequisites

Install the snap package manager using the apt command in case your system doesn't have it: sudo apt update && sudo apt install -y snapd

Step 1:

Start by opening a terminal window and execution of the bellow apt command. Select your preferred version to install: sudo snap install intellij-idea-community --classic

Step 2:

You can start the IntelliJ IDEA using the below command: intellij-idea-community You can reboot apply change to Linux system

@codedeep79
codedeep79 / "Unable to locate package" while trying to install packages with APT.md
Created July 27, 2022 01:36
"Unable to locate package" while trying to install packages with APT

When I try to install any package through the command line, I get an error:

sudo apt-get install <package>
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package <package>

First, check if the package actually does exist: