Is it possible to remove websites from Plesk using SSH?

Marc van Leeuwen

Premium Member
Joined
May 29, 2016
Messages
1,132
Points
63
I am using plesk obsidian with license trial, and today trial is expired and I got a new license trial but when I submitted it, plesk alerted that I am using more than 3 websites on my Plesk control panel thus it didn't allow me to add trial license key. So, I want to remove sites on my plesk so that I can submit license key trial from SSH, is that possible?
 

Hugo E.

Active member
Joined
Sep 8, 2014
Messages
288
Points
28
Yes, it is possible to remove websites from Plesk using SSH. Here are the steps you can follow:

Connect to your server using SSH.
Navigate to the directory where Plesk stores its configuration files. The location of this directory may vary depending on your server's operating system, but it is typically one of the following:
  • On CentOS/RHEL: /etc/httpd/conf/plesk.conf.d
  • On Debian/Ubuntu: /etc/apache2/plesk.conf.d
Create a backup of the configuration file that corresponds to the website you want to remove. For example, if the website is example.com, the configuration file might be /etc/httpd/conf/plesk.conf.d/vhosts/example.com.conf. You can create a backup of this file by running the following command:

Code:
cp /etc/httpd/conf/plesk.conf.d/vhosts/example.com.conf /root/example.com.conf.bak
Edit the configuration file using your preferred text editor. For example:
Code:
vi /etc/httpd/conf/plesk.conf.d/vhosts/example.com.conf
Find the section of the file that corresponds to the website you want to remove. This section will typically be enclosed in <VirtualHost> tags and will contain information about the website's domain name, document root, and other settings.

- Delete this section from the file.
- Save the file and exit the text editor.
- Restart Apache using the following command:

Code:
systemctl restart httpd
or
Code:
systemctl restart apache2
After completing these steps, the website should be removed from Plesk and you should be able to add your new trial license key. Please note that removing a website from Plesk using SSH can be complex and may have unintended consequences, so it is important to proceed with caution and ensure that you have a backup of your server's configuration files before making any changes.
 
  • Like
Reactions: Marc van Leeuwen

Marc van Leeuwen

Premium Member
Joined
May 29, 2016
Messages
1,132
Points
63
Marc van Leeuwen
I would ask, remove config file of a domain as above, will not remove its data?
 

Hugo E.

Active member
Joined
Sep 8, 2014
Messages
288
Points
28
Hugo E.
When you remove the configuration file of a domain as described above, it will only remove the configuration of the domain from Plesk. This will not remove the data associated with the domain, such as the website files or databases.

However, it is important to note that deleting the configuration file may cause the website to become inaccessible, since Plesk will no longer be able to manage the domain. Therefore, before deleting the configuration file, you should make sure that you have a backup of any website files and databases that are associated with the domain.

If you want to remove the data associated with a domain, you can do so using Plesk's web interface or by using SSH to delete the files and databases manually. However, it is important to exercise caution when deleting files and databases, as this can result in data loss if not done properly.
 

Hugo E.

Active member
Joined
Sep 8, 2014
Messages
288
Points
28
Hugo E.
Yes, you can also delete the configuration file for the domain if you have already backed it up and no longer need it. To delete the file, you can use the rm command followed by the path to the file:

Code:
rm /etc/httpd/conf/plesk.conf.d/vhosts/example.com.conf
This will delete the configuration file for the "example.com" domain from Plesk. However, as I mentioned earlier, please make sure that you have a backup of any website files and databases associated with the domain before deleting the configuration file.[/code]
 

Hugo E.

Active member
Joined
Sep 8, 2014
Messages
288
Points
28
Hugo E.
You can remove sites via SSH by using these ways:

Connect to your server via SSH.
Once connected, log in to the Plesk CLI using the following command:

Code:
plesk login
Enter your Plesk username and password when prompted.
To remove the domain, use the following command:

Code:
plesk bin domain --remove example.com
Replace "example.com" with the name of the domain you want to remove.
Confirm the removal of the domain by typing "y" when prompted.
Wait for the removal process to complete.

Verify that the domain has been removed by checking the list of domains in Plesk

Code:
plesk bin domain --list
This command will list all domains hosted on your server. If the domain you removed is no longer listed, it has been successfully removed from Plesk.

If you still get the error, you can need to reactivate the license key by running the following command

Code:
plesk bin license --retrieve
Hope it helped.
 

Daniel@30

Active member
Joined
Apr 6, 2018
Messages
179
Points
28
Yes, it is possible to remove websites from Plesk using SSH. You can do this by navigating to the relevant directory and using commands like `rm -rf` to delete the website's files and databases. However, proceed with caution, as this action is irreversible and should only be performed by experienced users.
 
Older threads
Replies
0
Views
3,227
Replies
9
Views
4,245
Replies
4
Views
4,635
Newer threads
Replies
0
Views
3,276
Replies
5
Views
3,061
Replies
3
Views
4,545
Replies
11
Views
4,142
Replies
3
Views
2,753
Latest threads
Replies
0
Views
589
Replies
2
Views
788
Replies
1
Views
309

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top