Error: MySQL server has gone away
“MySQL server has gone away”: This is an error when you tried to import a large file to MySQL/MariaDB. So, you can temporatly set max_allowed_packet by below guide: Your file size (MB): X Your file size (bytes): Y = X*1024*1024. Example: X = 2GB => Y = 2,097,152,000,000 Your import commands likes this:
Install and Config Mosquitto (MQTT broker server)
MQTT is a super lightweight IoT protocol on TCP/IP with …8 bits header. Send and receive messages with others in “topic” like as a chatroom. Install Mosquitto (MQTT Broker Server) Install MQTT broker on server Create user and password (exp: admin): Sercurity config: Open file /etc/mosquitto/mosquitto.conf to add this config to require password when connect:…
Config Cyberpanel/ OpenLiteSpeed server to run NodeJS on port 80/443
If you use LiteSpeed, you can run NodeJS project as a PHP project. Step 1: Add a domain (example domain.com) to your server You need to: Create a folder to upload your code. Or create by Cyberpanel admin tool (recommend). Add new DNS record (A) from domain to your server IP Step 2: Modify the…
Install MongoDB for PHP Laravel
At this moment, php-mongodb support PHP7.2 for Laravel. You need to change PHP-cli to 7.2 (my server use OpenLiteSpeed): Depend on your server OS, your commands like as: Add “extension=mongodb.so” to php72 config (php.ini). Restart your php server: For OpenLiteSpeed: systemctl restart lsws In your project folder, run:
Quick install MongoDB on Centos 8/ Rocky Linux in 1 minute
In Centos/ Rocky Linux terminal, run all bellow command: You can connect your DB by MongoDB Compass app in manual Change your MongoDB port and bind IP in: /etc/mongod.conf
Basic and Important CloudFlare Firewall Configuration for Website Protection?
You need to this basic CloudFlare Firewall Configuration to protect your login page. Click Edit expression to paste them: Basic and Important CloudFlare Firewall Configuration Rule 1: This is Challenge Captcha for url “/wp-admin” (or something you are) when request from Your Country (ex: VN): Rule 2: This is for Block if request from other…
Config Kibana + Elasticsearch 100% working on Linux (Centos/ Rocky)
Install JAVA First, install Java 1.8. Check java, install if not exist: Open firewall TCP port 9200, 8200, and 5601 Install ElasticSearch: Install Elasticsearch: Config ELS: Save xml file then: Config tempdir to work with JAVA: Above for Elasticsearc 7.15. For newer Elasticsearch version maybe: Save elasticsearch file, then restart & check status: If everything…
Install AAPT service to read APK file information on Linux (Centos/ Rocky)
If you want to run aapt read apk file information: STEP 1: Download aapt-linux build-tool at https://androidaapt.com/STEP 2: Copy the entire lib64 folder to usr/lib64 on centosSTEP 3: Copy the aapt file to the usr/bin directory and then chmod +x aapt (755)Example reading file version: Example reading file package name: In your script (my example…
Download APK file by PHP script
This is 100% working PHP script to download a APK file, or any extension: By this way, you can restrict directly download. And you can count downloaded too.
Install & Config Supervisor to keep terminal live to run script on Linux
You can keep a script (like as PHP or JS, Java,…) always live by Supervisor. To install Supervisor on Centos 8/ Rocky Linux: On Centos 7 use “yum” instead of “dnf”. Create a file myname.ini in folder /etc/supervisord.d/ with below content: Update data: Start program: If just start my-first-program: Check program status: You can restart…