Posts

Deploy nextjs in nginx with PM2

Step by Step In next.config.mjs comment // output: 'export' $ npm run build  In next.config.mjs Uncomment // output: 'export' $ npm run build Move nextjs directory to /var/www/ in VPS without node_modules (It's Big files) $ npm i $ cd /etc/nginx/sites-available server {     listen 80;     server_name proj.consultechbd.com;  # Replace with your actual domain name     location / {         #root   /var/www/nextjs-paikari/out;         #index  index.html;         proxy_pass http://localhost:3000;         proxy_http_version 1.1;         proxy_set_header Upgrade $http_upgrade;         proxy_set_header Connection $connection_upgrade;         proxy_set_header Host $host;         proxy_cache_bypass $http_upgrade;     }     location /_next/static/ {         alias /var/www/nextjs-paikari/out/_next/static/;         #expires 1d;         access_log off;     }     location /static/ {         alias /var/www/nextjs-paikari/out/static/;         #expires 1d;         access_log off;  

Transfer file to Server and vice versa

Local to Server:   scp -P 2222 /absolute_path/source-folder/some-file user@example.com:/absolute_path/destination-folder Server to Local: scp -P 2222 u ser@example.com:/absolute_path/destination-folder /absolute_path/source-folder/some-file How do I extract tar.xz files in Linux? The syntax is: Install xz using the  dnf install xz  on a CentOS/RHEL/Fedora Linux. Debian/Ubuntu Linux users try  apt install xz-utils  command. Extract tar.xz using the  tar -xf  backup.tar.xz  command To decompress filename.tar.xz file run:  xz -d -v  filename.tar.xz

Timezone missing in mysql database (celery periodic task)

 Ref:  https://stackoverflow.com/questions/21351251/database-returned-an-invalid-value-in-queryset-dates#21571350 You have to load timezone tables into mysql ( http://dev.mysql.com/doc/refman/5.6/en/mysql-tzinfo-to-sql.html ). Try execute on your database server: mysql_tzinfo_to_sql / usr / share / zoneinfo | mysql - D mysql - u root - p And then run "flush tables" or "flush query cache", otherwise the problem may not disappear even though you've loaded the correct timezone data: mysql - u root - p - e "flush tables;" mysql

How to Import and Export MySQL Database Command line in Linux

************ TO EXPORT ************ 1. SSH login as root. 2. Run command   mysqldump -a -u ejobsolution_db_user --password= db_password ejobsolution_db > ejobsolution_db.sql Download ejobsolution_db.sql from root directory Reference:  https://webhostinggeeks.com/howto/import-and-export-mysql-database-command-line-in-linux/ Reference:  https://archive.virtualmin.com/node/6032 How to Export MySQL Database Command line in Linux 1. Syntax to Export: mysqldump -u USERNAME -p DATABASE_NAME > filename.sql How to Export MySQL Database Command line in Linux 2. Syntax to Import: mysql -u USERNAME -p DATABASE_NAME < filename.sql CREATE USER 'db_user'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON * . * TO 'db_user'@'localhost'; mysql -u db_user -p CREATE DATABASE db_name;

Laravel Stuffs

Create project with composer: composer create-project laravel/laravel example-app To run with IP address for Mobile app development: php artisan serve --host 0.0.0.0 --port 8000  To migrate: php artisan migrate Sqlite: touch database/database.sqlite User absolute path for sqlite: DB_CONNECTION=sqlite  DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=/media/than/8d3a469e-9421-470b-842e-26012f02dd47/than/dev_laravel/example-app/database/database.sqlite DB_USERNAME=root DB_PASSWORD= Reference:   https://laravel.com/docs/9.x/installation

JAVA_HOME setup and Integrate with Android Studio Project in Ubuntu

 $ whereis jvm      jvm: /usr/lib/jvm $ nano .bashrc Write :      JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64      export JAVA_HOME      PATH=$PATH:$JAVA_HOME/bin      export PATH Close Terminal and Re-open Terminal: $ echo $JAVA_HOME      /usr/lib/jvm/java-11-openjdk-amd64 Reference :  https://youtu.be/106uH7USwZ8 In Android Studio: Fire->Project Structure -> Need to update in SDK Location and Modules sections to java-11 Reference:  https://youtu.be/lv-jE2d4Aoc

Generate SHA-1 and SHA-256 for Debug and Release android app

Go to the Root directory of the project and generate on Terminal. Debug SHA-1 and SHA-256:      keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android Release SHA-1 and SHA-256: keytool -list -v -keystore /home/than/flutterProjects/PlayStoreKeystore/farm_to_retail.jks - alias key0