Web Application

Bỏ tầm 10 năm code kiếc giờ quay lại quẩy

Web UI

Mọi thứ về Web Ui và làm sao để mình tạo ra web ui một cách thành thạo về một UI. Ở đây, vì mình học nodejs, nextjs nên mình chọn một ui đơn giản nhất để bắt đầu học và mần. Đó là Charkra UI.

Lỗi và Giải Pháp

Lỗi và Giải Pháp

DISPLAY và DNS puppeteer trên vagrant virtualbox

Lỗi thường gặp:

npm install puppeteer

sudo apt-get install libnss3-dev

sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev

sudo apt-get install -y xvfb

sudo apt-get -y install xorg xvfb gtk2-engines-pixbuf
sudo apt-get -y install dbus-x11 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic xfonts-scalable

sudo apt-get -y install imagemagick x11-apps

Xvfb -ac :99 -screen 0 1280x1024x16 &
export DISPLAY=:99

Lỗi DNS error:

npm config rm proxy
npm config rm https-proxy --tried removing npm proxy
sudo vi /etc/resolv.conf

Điền thêm dns name resolver vào, bên dưới nameserver đầu tiên:

nameserver 127.0.0.53
nameserver 192.168.1.11

options edns0 trust-ad

Ref:

https://stackoverflow.com/questions/60304251/unable-to-open-x-display-when-trying-to-run-google-chrome-on-centos-rhel-7-5

 

Lỗi và Giải Pháp

Yarn Command vs NPM Command

Use the following command :

yarn add [package_name]

Comparing npm and Yarn Commands

Install dependencies

npm install => yarn 

Install a package

npm install [package_name] => yarn add [package_name]

Install a package globally

npm install -g [package_name] => yarn global add [package_name]

Install a package as a development dependency

npm install --save-dev [package_name] => yarn add --dev [package_name]

Uninstall a package

npm uninstall [package_name] => yarn remove [package_name]

Uninstall a package globally

npm uninstall -g [package_name] => yarn global remove [package_name]

Uninstall a development dependency package

npm uninstall --save-dev [package_name] => yarn remove [package_name]

Update the dependencies

npm update => yarn upgrade 

Update a package

npm update [package_name] => yarn upgrade [package_name]

Create a new package

npm init => yarn init

Run a script defined in the package.json

npm run => yarn run

Test a package

npm test => yarn test

Publish a package

npm publish => yarn publish

Remove all data from the cache

npm cache clean => yarn cache clean
Lỗi và Giải Pháp

Error while loading shared libraries: libnss3.so

Lỗi này thường xuất hiện khi bạn cài puppeteer trên ubuntu mới.

Thử command sau đây

sudo apt-get install libasound2

Không được thì thử cái này:

sudo apt install libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev

 

 

Setting Up Multiple Sites within Nginx

Setting Up PHP Nginx MariaDB

Tutorial: https://gist.github.com/nd3w/8017f2e0b8afb44188e733d2ec487deb

Setting up Multiple Sites:

https://www.youtube.com/watch?v=gsSGDEexBl8&t=866s

Basically you will need to create new conf file rules for nginx to load in sites-enabled or conf.d folder

/etc/nginx/conf.d/example.conf

root /var/www/example1; <<< example site folder path
server_name example1.kyluat.lan example1.com; << example domain name with local dns pi hole setted up that point to the server ip address.

server {
        listen 80;
        listen [::]:80;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/example1;

        # Add index.php to the list if you are using PHP
        index index.html;

        server_name example1.kyluat.lan example1.com;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        # pass PHP scripts to FastCGI server
        #

        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        }
        
        #location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
        #       fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}

 

Re-Invent dead sites' Content

What i am about to do is to earn some money to support my life:

  1. Choosing the niche that is easy to extract database and rank on google
  2. Extract data and put them into structured database 
  3. Use AI to re-write the content
  4. Create a unique website using nextjs and nestjs as API
  5. let the miracle grow.