I need to change public_html to just public for a script

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

just use a symbolic link go to the directory on the server that contains public_html and use this command

ln -s public_html public 

That will create a symbolic link for your script to use. easy peasy.

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

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"