cPanel - Advanced Functions
By Staff
By Staff
Article on how to use some of the advanced functions available in cPanel
How to Setup Node.js Application in cPanel
The Node.js selector allows you to easily set up Node.js applications with the cPanel graphical interface. Some Definitions: You should change these values to match the values required for your account and application. - app: is used as an example for the application root directory and application uri - example: is used as example for the username - example.com is to illustrate the domain - app.js is used as example for the application startup file - My app will be used as the description - 10 or 11 are the node.js versions Setting up the NodeJs app: To set up a Node.js application using cPanel, follow the steps below. Step 1 - Create the application: 1. First, you need to login to cPanel. For help in accessing cPanel, click on this Link 2. In the SOFTWARE section of cPanel, click the Setup Node.js App icon to open the Node.js selector: 3. On the Node.js selector page, click CREATE APPLICATION to start the application setup: 4. Fill in the fields on the application setup form: - Node.js version: select your preferred version from the drop down list - Application mode: choose Development or Production from the list. Development may be chosen initially and changed to production later. - Application root: the file system location for application files. The entry will be appended to /home/username to form the complete path to the application files in the cPanel home directory. Typical locations for the application root are /home/username/appname or /home/username/apps/appname. Do not put the application root inside the domain document root. - Application URL: the address of the application to be accessible from the Internet. When you define routes in your application code, you must include the application URL in the route. - Application startup file: the initial file that will be processed when launching the application. 5. When you're happy with your settings. click on CREATE: 6. The app should start automatically if you setup everything correctly. Click on OPEN to view the test page. Step 2 - Create the package.json file: Follow these steps to create the package.json file: 1.from cPanel open the File Manager: 2. From the directory tree on the left, find and click on the application root folder (you should have already specified this in the steps above): 3. Find and click +File icon to create a new file: 4. In the New Filedialog box, type the filename package.json, and then click Create New File: 5. Right-click or secondary click on the package.json file in the right-hand column of File Manager and then click Edit. An edit dialog box may appear (click OK to proceed to the Editor): 6. In the Editor screen, you should have something like the example below in the package.json file (modify according to your app): {"name": "app","version": "1.0.0","description": "My App","main": "app.js","scripts": {"test": "echo \"Error: no test specified\" && exit 1"},"author": "John Doe","license": "MIT"} 7. Click Save Changes to save the file: 8. Click Close to close the editor. Step 3 - Installing npm: 1. In the SOFTWARE section of cPanel, click on the Setup Node.js App icon to open the Node.js selector: https://dash.wevrlabs.net/images/kb/19_cpanel-setup-node-app.jpg 2. In the Actions column of the Web Applications list, click the pencil icon to edit the application: 3. Click Run NPM Install: 4. The NPM installation runs and displays a success indicator if you have everything setup correctly:
How to create Cronjob via cPanel?
1. Log into your cPanel account. 2. In the "Advanced" section, click on "Cron Jobs" Icon. 3. Under "Add New Cron Job", click on the "Common Settings" dropdown menu and select an appropriate option such as "Once Per Day" or another suitable option. 4. Enter your cronjob php file location or the command you want to run in the Command field. 5. Click on the "Add New Cron Job" button.
How to Edit or Delete Cronjob via cPanel?
How to Edit Cronjob? 1. Log into your cPanel account. 2. In the "Advanced" section, click on "Cron Jobs" Icon. 3. Scroll down to the end of page and under "Current Cron Jobs", locate your cronjob and then click on the "Edit" button. 4. Make appropriate changes and then click on the "Edit Line" button. How to Delete Cronjob? 1. Under "Current Cron Jobs", locate your cronjob and then click on "Delete" button 2. Under "Delete this cron job?" text, click the "Delete" Button.
How to Update a Cronjob E-mail Address?
If you want to receive a cronjob error or notification, you can update your e-mail address from the cPanel's Cronjob Page. 1. Log into your cPanel account. 2. In the "Advanced" section, click on "Cron Jobs" Icon. 3. Under "Cron Email" you should enter your full e-mail address in text field. 4. Click on the "Update Email" Button.
How to change PHP version on your domain using cPanel?
Some software requires older version of PHP like 5.6 while other asks for PHP7. If it happens you need either of the versions, you can switch to it from cPanel. 1. Log into your cPanel account. 2. In the "Software" section, click on the "MultiPHP Manager" Icon. 3. Scroll down to the bottom of the page, select your domain from the left side of the screen and you will see an option "PHP Version" with a drop-down menu on the right side. Select the appropriate PHP version from it and click the Apply button. If will take a few seconds and then your PHP version will change to your selected version.
How to Reset the PHP Version to the Default Version, Using cPanel?
If you wish to reset the PHP version to the default version, follow these instructions: **1. **Log into your cPanel account. 2. In the "Software" section, click on the "MultiPHP Manager" Icon. **3. **Scroll down to the end of the page, select your domain from the left side and you will see the option "PHP Version" with a drop-down on the right side. Select the "inherit" option from the drop-down menu and click the Apply button. If will take a few seconds, after which your PHP version will reset to the default version.
How to Set the PHP Version per Domain, Using cPanel?
Do you have multiple domains and you wish to set the PHP version per domain? For example, you have the domains Example1 and Example2 and you want to set PHP7 on Example2 domain and PHP 5.6 on Example1. You will need to do this from the cPanel. **1. **Log into your cPanel account. **2. **In the "Software" section, click on the "MultiPHP Manager" Icon. 3. Scroll down to the end of page, select your domain from the left side and you will see the option "PHP Version" with a drop-down list on the right side. Select the appropriate PHP version from the drop-down menu and then click on Apply. 4. Now that you want to set PHP 5.6 on Example2, scroll down and select the example2 domain. Then set the PHP version to 5.6. Congratulations, both of your domains use different different PHP versions now.
How to Set the PHP Version per Folder?
Do you have a single domain or wish to use different PHP version per folder? Do you have an installed PHP 5.x software in a folder/blog and want to use a PHP 7.x instead? If so, you can do this using cPanel and the .htaccess file. 1. Log into your cPanel account. 2. In the "Software" section, click on the "MultiPHP Manager" icon. **3. **Assume that we are new to this and the first thing we will need to do is to get the code generated by cPanel. 4. Scroll down to the end of page, select your domain from the left side and you will see the option "PHP Version" with a drop-down list on the right side. Select the appropriate PHP version from the drop-down menu and click the Apply button. **5. **Now open the /public_html/.htaccess file in the cPanel File Manager or in your FTP client and you will find the code generated by cPanel. **6. **After you copy the code, you will wish to set the PHP version to version 7 in the folder/forum, which means you will need to create a .htaccess file in the folder /forum/ and paste the code which was generated in the previous step in it. 7. Congratulations, now your folder/forum uses PHP 7, and if you wish to set any other folder to use the same version of PHP as well, you will only need to copy the code from the .htaccess file and paste it into that folder. Reset your PHP version from your main domain. If you wish to use a different PHP version on any folder, you will need to follow steps 5 and 6, generate the code, copy that code from /public_html/.htaccess and paste it into any folder where you wish to set your selected PHP version.