Hello… I would like to change the place where I put the root files of my virtual web directory from public_html to just public. I’ve tried moving the directory to a new location but it always creates a public_html as where I need to put my files.
The template change will be hassle-free for new virtual servers. But it’s not a fully automatic change if you’re updating the document root for existing virtual servers.
First check the Apache config for references to the old DocumentRoot. If the file needs updating restart Apache server and see if that works. For testing make sure there’s at least an index.html file in the public directory that displays something.
Second thing to check for is a leftover public_html directory with content still in it. If public is empty but public_html contains files, move the files to public.
If it’s still not working, your path with least resistance (no pun intended) may be to delete the virtual server and re-create it from scratch.
I deleted the virtual servers and I make the changes you suggested. The files were created in the public directory as expected. When I ran the preview to see how it looked I got a 403 forbidden You don’t have permission to access this resource.
Hello Richard… I thought of all those things too. I checked the permissions (the same as the files in the public_html directory and the ownership too. In fact, just to make sure I redid the ownership. I know a file or directory created and owned by root can’t be seen. I’ll double check again in the morning (it’s getting late here in Florida). But I thought the same thing… rights issues. In fact I deleted the existing virtual servers before I changed the location of the directory, and then I recreated the virtual servers. As a result, everything was created by the system not me (including the sample html file) I thought that way I couldn’t go wrong. But when I was all done access to the directory was forbidden. There is no htaccess file in it… it contains all the normal files you get when you create a new virtual server… index.html, awstats etc.
Actually I just found the solutions. The solution is to edit the server template in two place in the first section
Go to Sever Templates Then select Apache Web Server (I’m using Ubuntu)
There are three changes you need to make
Two in this section
ServerName ${DOM}
ServerAlias www.${DOM}
ServerAlias mail.${DOM} DocumentRoot ${HOME}/public
ErrorLog /var/log/virtualmin/${DOM}_error_log
CustomLog /var/log/virtualmin/${DOM}_access_log combined
ScriptAlias /cgi-bin/ ${HOME}/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5 <Directory ${HOME}/public>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
<Directory ${HOME}/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Users’ website subdirectory to create Default (public_html) Directory under home - name this the same as the others… in my case public
Then when you generate a new domain the entire directory structure will be exactly right but the name of the directory where the website code goes is changed from public_html to whatever you want to call it. In my case I called it public