So, this. This has been a pain in the ass for EVER. Every time I install VestaCP, I have to fix this before doing anything else with my code.
This issue wasn’t there when I started using VestaCP. Then came an update. Yeah, you get my point. ????
I know it’s good for security. But still it’s a pain. So here’s how to get stuff working.
Please replace the following things with yours in my commands.
- User: admin
- Domain: example.com
- Text-Editor: nano
- Folder I want include files from: /home/%user%/web/%domain%/project
- Change directory to your VestaCP user’s web config folder1
cd
/home/admin/conf/web
- List files1
ls
-la
You should see some files like
12example.com.httpd.conf
example.com.nginx.conf
- Open up ‘example.com.httpd.conf‘ in a text editor
Content will be similar to the follwing123456789101112131415161718192021222324252627282930313233343536<VirtualHost ***.***.***.***:****>
ServerName example.com
ServerAlias www.example.com
ServerAdmin info@example.com
DocumentRoot
/home/admin/web/example
.com
/public_html
ScriptAlias
/cgi-bin/
/home/admin/web/example
.com
/cgi-bin/
Alias
/vstats/
/home/admin/web/example
.com
/stats/
Alias
/error/
/home/admin/web/example
.com
/document_errors/
#SuexecUserGroup admin admin
CustomLog
/var/log/httpd/domains/example
.com.bytes bytes
CustomLog
/var/log/httpd/domains/example
.com.log combined
ErrorLog
/var/log/httpd/domains/example
.com.error.log
<Directory
/home/admin/web/example
.com
/public_html
>
AllowOverride All
Options +Includes -Indexes +ExecCGI
php_admin_value open_basedir
/home/admin/web/example
.com
/public_html
:
/home/admin/tmp
php_admin_value upload_tmp_dir
/home/admin/tmp
php_admin_value session.save_path
/home/admin/tmp
<
/Directory
>
<Directory
/home/admin/web/example
.com
/stats
>
AllowOverride All
<
/Directory
>
<IfModule mod_ruid2.c>
RMode config
RUidGid admin admin
RGroups apache
<
/IfModule
>
<IfModule itk.c>
AssignUserID admin admin
<
/IfModule
>
IncludeOptional
/home/admin/conf/web/httpd
.example.com.conf*
<
/VirtualHost
>
- Append the folder you want to ‘php_admin_value open_basedir‘ like the following example1
php_admin_value open_basedir
/home/admin/web/example
.com
/public_html
:
/home/admin/tmp
:
/home/admin/web/example
.com
/project
- Save and quit the file
- Restart Apache Server
You could use the VestaCP interface to restart the Apache Server OR use the following command1service httpd restart
Cheers!