Fixing VestaCP open_basedir error 1
Linux,  VestaCP

Fixing VestaCP open_basedir error

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
  1. Change directory to your VestaCP user’s web config folder
    1
    cd /home/admin/conf/web
  2. List files
    1
    ls -la

    You should see some files like

    1
    2
    example.com.httpd.conf
    example.com.nginx.conf
  3. Open up ‘example.com.httpd.conf‘ in a text editor
    Content will be similar to the follwing

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    <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>
  4. Append the folder you want to ‘php_admin_value open_basedir‘ like the following example
    1
    php_admin_value open_basedir /home/admin/web/example.com/public_html:/home/admin/tmp:/home/admin/web/example.com/project
  5. Save and quit the file
  6. Restart Apache Server
    You could use the VestaCP interface to restart the Apache Server OR use the following command

    1
    service httpd restart

Cheers!

Nguồn

Avatar of jamesblackvn

Tui là jamesblackvn!

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Website này sử dụng Akismet để hạn chế spam. Tìm hiểu bình luận của bạn được duyệt như thế nào.