Submitted by danwtsa on Tue, 07/21/2020 - 19:25 Pro Licensee
A new script I want to run requires that the public directory is named public rather than public_html. I tried changing the server template by changing two things
1 Directives and settings for new websites - edit the line
2 Users’ website subdirectory to create public
3 I deleted all the old virtual servers and created new ones.
The structure was created correctly with all the same files I had in public_html but when I went to view it the site gave me a 403 Forbidden error
What can I do to fix this?
Dan Lewis
Status:
Active
Comments
Submitted by Nsis_licensing on Wed, 07/22/2020 - 13:46 Pro Licensee Comment #1
just use a symbolic link go to the directory on the server that contains public_html and use this command
That will create a symbolic link for your script to use. easy peasy.
Submitted by danwtsa on Wed, 07/22/2020 - 21:09 Pro Licensee Comment #2
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 Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch allow from all AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch allow from all AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
One in this section:
Users' website subdirectory to create Default (public_html) Directory under home
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
Submitted by Nsis_licensing on Thu, 07/23/2020 - 12:30 Pro Licensee Comment #3
I would caution against this as so many scripts/applications and services often assume public_html as the directory. It so much easier to create a symbolic link an leave everything else alone. You scrip that requires "public" will be none the wiser and nothing else will break. If you do make the changes I would suggest creating a symbolic link to the "public" directory called "public_html"