This is a new php info file

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);

?>

This is Bash

# cat /etc/nginx/conf.d/rocketchat.conf
server {
        server_name chat.ipgw.io;

        error_log /var/log/nginx/rocketchat_error.log;

        location / {
            proxy_pass http://127.0.0.1:3000/;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto http;
            proxy_set_header X-Nginx-Proxy true;
            proxy_redirect off;
        }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/chat.ipgw.io/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/chat.ipgw.io/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = chat.ipgw.io) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80;
        server_name chat.ipgw.io;
    return 404; # managed by Certbot

This is Javascript

<script>
    alert( 'Hello, world!' );
  </script>

This is CSS

body {
  background-color: linen;
}

h1 {
  color: maroon;
  margin-left: 40px;
} 

Add the server Block

sudo nano /etc/nginx/sites-available/your_domain

Add the following configuration block, which is similar to the default, but updated for your new directory and domain name:


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

        root /var/www/your_domain/html;
        index index.html index.htm index.nginx-debian.html;

        server_name your_domain www.your_domain;

        location / {
                try_files $uri $uri/ =404;
        }
}

Enable this server block by creating a symbolic link to your custom configuration file inside the sites-enabled directory, which Nginx reads from during startup:

sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled

Mysql import error was shown when exporting a database from cPanel to a local server.

During the migration of a web application, I got the below error while restoring a database on another server. The collation id may differ based on the MySQL version.

Error message:

mysql backup.sql < backup.sql
ERROR 1253 (42000) at line 31: COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'utf8'

The MySQL server running on the new server is an older version than the source server. The destination server doesn’t contain the required database collation.

To resolve, edit the database backup file in text editor and replace “utf8mb4_0900_ai_ci” with “utf8mb4_general_ci” and “CHARSET=utf8mb4” with “CHARSET=utf8“.

Replace the below string:

ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

with:

ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

Save your file and restore the database.

The Linux system users can use the sed command to replace text in files directly.

sed -i 's/utf8mb4_0900_ai_ci/utf8_general_ci/g' backup.sql  
sed -i 's/CHARSET=utf8mb4/CHARSET=utf8/g' backup.sql  

That it. after the above changes, the database was successfully restored!