Please note I did not create any Virtual Hosts in Virtualmin before.
Let's replicate this issue:
Go to Webmin -> Servers -> Apache Webserver and select [Existing virtual hosts] tab.
Just after Virtualmin/Webmin Terminal installation there are two default rows here: Default Server and Virtual Server. Let's select the second row Virtual Server and delete it.
As you know Apache keeps virtual host configurations in two folders in /etc/apache2: [sites-available] and [sites-enabled]. I checked both folders just after deleting the default Virtual Server.
sites-available content before delete: "default" and "default-ssl" files sites-available content after delete: "default-ssl" file. "default file" was deleted
sites-enabled content before delete: 000-default (as link to sites-available/default) sites-enabled content after delete: 000-default (as link to sites-available/default)
Try to Apply new configuration, you will get an error message. This is happening because the link is still in sites-enabled folder.
Here are my comments.
When you delete a Virtual Server you should delete it mainly from sites-enabled folder not only from sites-available. It is an unlink command. As it is now Apache server won't start or restart after deleting it.
My advice is when you delete a Virtual Server inside Webmin - Apache, just unlink the file associated to that Virtual Server from sites-enabled folder only. Do not deleted it from sites-available. If I would like to link the file again I still have it. This is up to you.
Thank you.
Comments
Submitted by JamieCameron on Thu, 12/25/2014 - 00:40 Comment #1
So Webmin should have deleted the entry from the
sites-available
directory as well - there is no support currently for keeping disabled websites around.Is the
000-default
link an absolute or relative path? You can tell by looking at the link destination with a command likels -l /etc/webmin/sites-enabled/000-default
Submitted by ADDISON74 on Thu, 12/25/2014 - 05:18 Comment #2
Here is what is going on with the files on disk (ls -lah command in console):
FRESH INSTALL (DEBIAN + VIRTUALMIN/WEBMIN)
/sites-available
- default
- default-ssl
/sites-enabled
- 000-default -> ../sites-available/default
AFTER DELETING Virtual Server in Webmin interface
/sites-available
- default-ssl
/sites-enabled
- 000-default -> ../sites-available/default
As you can see default file was deleted from sites-available folder, but its link is still on disk in sites-enabled.
Please go into console and execute this command: "service apache2 restart". You will get the following error:
apache2: Syntax error on line 268 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/000-default: No such file or directory.
Action 'configtest' failed.
The Apache error log may have more information.
failed!
Now, let's unlink 000-default file from /sites-enabled and restart the service. We get:
[ ok ] Restarting web server: apache2 ... waiting .
Conclusion, it is not enough to delete the file from sites-available folder, you should also delete its symbolic link from sites-enabled folder.
If you delete in Webmin this default Virtual Server and restart Apache it won't work, Apply changes won't work too.
My suggestions from above:
1) Delete the symbolic link and keep the file in sites-available (like a backup)
2) Delete the symbolic link and the file in sites-available (completely delete)
Submitted by ADDISON74 on Thu, 12/25/2014 - 05:41 Comment #3
... and an answer to your question related to command "ls -l /etc/webmin/sites-enabled/000-default"
No such file or directory.
I changed webmin with apache2 and it is a relative path:
ls -l /etc/apache2/sites-enabled/000-default
/etc/apache2/sites-enabled/000-default -> ../sites-available/default
In my opinion no matter if this link is absolute or relative. Once you delete it everything works just fine.
Submitted by JamieCameron on Sat, 12/27/2014 - 14:09 Comment #4
Thanks, that's what I needed - it is the relative link that causes Webmin to misbehave here. This will be fixed in the next Webmin release.
Submitted by Issues on Sat, 01/10/2015 - 14:11 Comment #5
Automatically closed -- issue fixed for 2 weeks with no activity.