apache change home directory

During the development process of php, the default directory of the installed apache is /var/www/. This directory sometimes has user permissions. For example, when using php to upload files to the project directory, there will be permissions. The file is modified. At this time, you can modify the default directory of the apache2 website, so as to avoid the above problems.

The change process is relatively simple. You only need to modify the apache2 configuration file.
sudo gedit /etc/apache2/sites-enabled/000-default
Find the DocumentRoot field in the document, and then modify the directory where you want to place the web page file. Then save and restart the apache service:
sudo service apache2 restart
so that the website default directory is modified.

Connecting to phpmyadmin
During the installation process, users may also configure phpmyadmin. At this time, you can directly move the entire phpmyadmin folder to the default directory of the website you modified. This will give you access to phpmyadmin.

If the home directory is set to /home/web/, by default this directory has no permission to access, it will prompt
You don't have permission to access /index.php on this server.
Open //etc/apache2/apache2.conf, Add to
<Directory /home/web/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Allow from all
</Directory>


Note, modify the access permissions of the root directory
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

sudo service apache2 restart

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326445200&siteId=291194637