<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Takdirul Islam Shishir</title>
    <description>The latest articles on DEV Community by Takdirul Islam Shishir (@iamtakdir).</description>
    <link>https://dev.to/iamtakdir</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F731775%2Faa567b06-87ec-4342-964b-92de70e49c79.jpeg</url>
      <title>DEV Community: Takdirul Islam Shishir</title>
      <link>https://dev.to/iamtakdir</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iamtakdir"/>
    <language>en</language>
    <item>
      <title>cPanel UAPI Operations for Creating Subdomains, MySQL Databases, and File Operations</title>
      <dc:creator>Takdirul Islam Shishir</dc:creator>
      <pubDate>Thu, 14 Mar 2024 19:05:10 +0000</pubDate>
      <link>https://dev.to/iamtakdir/cpanel-uapi-operations-for-creating-subdomains-mysql-databases-and-file-operations-47g9</link>
      <guid>https://dev.to/iamtakdir/cpanel-uapi-operations-for-creating-subdomains-mysql-databases-and-file-operations-47g9</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F81bxmn2qxctph10a5vur.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F81bxmn2qxctph10a5vur.png" alt="itwasCpanel" width="512" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;the cPanel User API (UAPI) stands out as a powerful interface for automating tasks and streamlining administrative operations. In this guide, we will delve into the practical usage of cPanel UAPI for creating subdomains, MySQL databases, and file operations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api.docs.cpanel.net/cpanel/introduction/" rel="noopener noreferrer"&gt;UAPI Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Managing Subdomains&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Subdomains are indispensable for organizing and structuring websites within a domain. With cPanel UAPI, creating subdomains becomes a breeze. The following command snippet demonstrates how to create a subdomain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uapi SubDomain addsubdomain &lt;span class="nv"&gt;domain&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;subdomain &lt;span class="nv"&gt;domain&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;example.com &lt;span class="nv"&gt;rootdomain&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;example.com &lt;span class="nb"&gt;dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;public_html/subdomain
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simply replace &lt;code&gt;subdomain&lt;/code&gt; with your desired subdomain name and &lt;code&gt;example.com&lt;/code&gt; with your domain. Additionally, adjust the directory path (&lt;code&gt;dir&lt;/code&gt;) as needed to reflect your hosting environment's structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Managing MySQL Databases&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;MySQL databases are the backbone of many web applications, storing crucial data and enabling dynamic content generation. Leveraging cPanel UAPI, you can effortlessly create MySQL databases and users with tailored privileges. Let's break down the process into two steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Creating a MySQL Database:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uapi &lt;span class="nt"&gt;--user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;username Mysql create_database &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mydatabase
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;username&lt;/code&gt; with your actual username and &lt;code&gt;mydatabase&lt;/code&gt; with the desired name for your MySQL database.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Creating a MySQL User and Granting Privileges:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uapi &lt;span class="nt"&gt;--user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;username Mysql create_user &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;myuser &lt;span class="nv"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mypassword
uapi &lt;span class="nt"&gt;--user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;username Mysql set_privileges_on_database &lt;span class="nv"&gt;user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;myuser &lt;span class="nv"&gt;database&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mydatabase &lt;span class="nv"&gt;privileges&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ALL_PRIVILEGES
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Substitute &lt;code&gt;username&lt;/code&gt;, &lt;code&gt;myuser&lt;/code&gt;, &lt;code&gt;mypassword&lt;/code&gt;, and &lt;code&gt;mydatabase&lt;/code&gt; with your specific values. These commands will establish a MySQL user with all privileges on the designated database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;File Operations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Efficiently managing files and directories is essential for maintaining a well-organized web hosting environment. With cPanel UAPI, you can perform file operations seamlessly. Let's explore two common tasks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Moving Files:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uapi Fileman move_file &lt;span class="nv"&gt;source_file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;public_html/oldfile.txt &lt;span class="nv"&gt;destination_file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;public_html/newfile.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;source_file&lt;/code&gt; and &lt;code&gt;destination_file&lt;/code&gt; paths as necessary. This command facilitates the relocation of files within your hosting space.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Moving Directories:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uapi Fileman move_dir &lt;span class="nv"&gt;source_dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;public_html/oldfolder &lt;span class="nv"&gt;destination_dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;public_html/newfolder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similar to moving files, this command relocates entire directories along with their contents, promoting efficient organization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Additional Tips:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While cPanel UAPI offers robust functionality, certain tasks may be better suited for direct execution via shell commands, especially for bulk operations. For instance, moving or copying files can be accomplished using standard bash commands like &lt;code&gt;mv&lt;/code&gt; and &lt;code&gt;cp&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Move all files from source directory to destination directory&lt;/span&gt;
&lt;span class="nb"&gt;mv&lt;/span&gt; /path/to/source/&lt;span class="k"&gt;*&lt;/span&gt; /path/to/destination/

&lt;span class="c"&gt;# Copy all files from source directory to destination directory&lt;/span&gt;
&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; /path/to/source/&lt;span class="k"&gt;*&lt;/span&gt; /path/to/destination/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These commands provide flexibility and efficiency, particularly for complex file management tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Author can talk :3
&lt;/h3&gt;

&lt;p&gt;In retrospect, I realize there may have been oversights in the documentation review. I apologize for any mistakes . Thank you for your understanding and feedback.&lt;/p&gt;

&lt;h3&gt;
  
  
  Need Personal Support?
&lt;/h3&gt;

&lt;p&gt;We provide custom solutions and support. Contact US at &lt;a href="https://solution.omega.ac" rel="noopener noreferrer"&gt;https://solution.omega.ac&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cpanel</category>
      <category>uapi</category>
      <category>iamtakdir</category>
    </item>
    <item>
      <title>Simple Guide to Deploying Your Vite React App on Cpanel for Beginners</title>
      <dc:creator>Takdirul Islam Shishir</dc:creator>
      <pubDate>Thu, 02 Nov 2023 08:08:54 +0000</pubDate>
      <link>https://dev.to/iamtakdir/simple-guide-to-deploying-your-vite-react-app-for-beginners-2e8h</link>
      <guid>https://dev.to/iamtakdir/simple-guide-to-deploying-your-vite-react-app-for-beginners-2e8h</guid>
      <description>&lt;h4&gt;
  
  
  Step 1: Specify Your Site's URL in Vite Config
&lt;/h4&gt;

&lt;p&gt;First off, we need to tell your Vite React app where it's going to be published on the internet. In your Vite project, there’s a file named &lt;code&gt;vite.config.js&lt;/code&gt;. Open this file and add a &lt;code&gt;base&lt;/code&gt; property under &lt;code&gt;export default defineConfig&lt;/code&gt;. This is where your site's URL will go. It should look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;base&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://myvitereactapp.com/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// ... other config settings&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 2: Prepare Your App for Deployment
&lt;/h4&gt;

&lt;p&gt;Now, let's get your app ready to go live. This step converts your project into a form that's more efficient for web browsers and usually it compresses your all CSS and JavaScript codes to make it more faster. Open your project's terminal, and run &lt;code&gt;yarn install&lt;/code&gt; to make sure all dependencies are up to date. After that, execute &lt;code&gt;yarn build&lt;/code&gt;. This will create a &lt;code&gt;dist&lt;/code&gt; folder in your project, holding the production-ready version of your app.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3: Zip the &lt;code&gt;dist&lt;/code&gt; folder
&lt;/h4&gt;

&lt;p&gt;Zip/ Compress your &lt;code&gt;dist&lt;/code&gt; folder, use any compressor tool to zip your &lt;code&gt;dist&lt;/code&gt; folder. Usually people uses (WinZip, 7zip, etc.) .&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4: Upload Your App to File Manager.
&lt;/h4&gt;

&lt;p&gt;Login in to the control panel or cPanel, and look for the &lt;code&gt;File Manager&lt;/code&gt;or you can use the search bar at the top to find the file manager. Inside the File Manager, you should see a folder named &lt;code&gt;public_html&lt;/code&gt;. This is where your react build source code will go.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fusm3jgvt39gzwcfflw4m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fusm3jgvt39gzwcfflw4m.png" alt="File Manager " width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3c1dznwhs8q19j178nex.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3c1dznwhs8q19j178nex.png" alt="public html" width="618" height="101"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 5: Uploading &lt;code&gt;dist.zip&lt;/code&gt; to &lt;code&gt;public_html&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;Click on upload button at the top of File Manager then Select the dist.zip file from your source code folder, then upload them directly into the &lt;code&gt;public_html&lt;/code&gt; folder on your cpanel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg5orx05cpxv5xmz4sz6c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg5orx05cpxv5xmz4sz6c.png" alt="Image upload" width="627" height="132"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fej4xogrc2zhnugq0y69a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fej4xogrc2zhnugq0y69a.png" alt="Image select" width="800" height="283"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 6: Extract Your Zip file
&lt;/h4&gt;

&lt;p&gt;After uploading the &lt;code&gt;dist.zip&lt;/code&gt; file you have to extract the zip file, click on to the zip button and click on to the extract button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbvxkjy4dhbqug56li74.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbvxkjy4dhbqug56li74.png" alt="extract" width="800" height="139"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvkqn4kv411fk6s4f8rxz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvkqn4kv411fk6s4f8rxz.png" alt="Image edit" width="538" height="160"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 7: Set Up Redirects for SPA
&lt;/h4&gt;

&lt;p&gt;Vite React apps are usually single-page applications (SPAs), and they require special handling of page requests. In the &lt;code&gt;public_html&lt;/code&gt; folder on your host, create a file called &lt;code&gt;.htaccess&lt;/code&gt;. Paste in the following configuration to manage redirects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apache"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nl"&gt;IfModule&lt;/span&gt;&lt;span class="sr"&gt; mod_rewrite.c&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="nc"&gt;RewriteEngine&lt;/span&gt; &lt;span class="ss"&gt;On&lt;/span&gt;
  &lt;span class="nc"&gt;RewriteBase&lt;/span&gt; /
  &lt;span class="nc"&gt;RewriteRule&lt;/span&gt; ^index\.html$ - [L]
  &lt;span class="nc"&gt;RewriteCond&lt;/span&gt; %{REQUEST_FILENAME} !-f
  &lt;span class="nc"&gt;RewriteCond&lt;/span&gt; %{REQUEST_FILENAME} !-d
  &lt;span class="nc"&gt;RewriteCond&lt;/span&gt; %{REQUEST_FILENAME} !-l
  &lt;span class="nc"&gt;RewriteRule&lt;/span&gt; . /index.html [L]
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nl"&gt;IfModule&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsrc2ly2983xpr8mt3i52.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsrc2ly2983xpr8mt3i52.png" alt="htaccess" width="800" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now save the .htaccess file.&lt;/p&gt;

&lt;h4&gt;
  
  
  CASE CLOSED !
&lt;/h4&gt;

&lt;p&gt;You've successfully deployed your Vite React Application! Visit your web address, and you should see your app shining back at you from the web. Congrats on bringing your project to the world!&lt;/p&gt;

&lt;h3&gt;
  
  
  Need Personal Support?
&lt;/h3&gt;

&lt;p&gt;We provide custom solutions and support. Contact US at &lt;a href="https://solution.omega.ac" rel="noopener noreferrer"&gt;https://solution.omega.ac&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>vite</category>
      <category>deploy</category>
      <category>cpanel</category>
    </item>
  </channel>
</rss>
