How to change the site folder in Apache2?

-4

I need help setting up LAMP. Everything is working perfectly. The things I would like to change are mere quirks, but I still find it interesting.

I would like to change the root directory. In case you are in: /var/www/html , I would like a directory in the documents, for example.

I would also like to remove the home screen:

Ineedtoplacethelocalhosthomescreeninthefolderandfileslist.Justit.Example:

    
asked by anonymous 28.12.2018 / 21:39

1 answer

1
  

To start I would like to change the folder's clearing, in case it is in: / var / www / html, I would like to put a directory in the documents eg

1) Open the Apache configuration file:

/etc/apache2/apache2.conf

2) Look for the configuration DocumentRoot and change to the directory you want:

By default, this should be: DocumentRoot "/var/www/html"

3) Look for the directory configuration and change the path as well:

<Directory "/var/www/public_html">
...
</Directory>
  

I need to place a simple index with the folders of my projects and nothing else in the place of this localhost home screen.

4) In the directory configuration, look for the line Options and make sure you have Indexes :

Options Indexes FollowSymLinks

5) In the file .htaccess there can not be the option -Indexes , or it will overwrite the directive in step "4)".

6) When you access the Apache directories, it automatically fetches some default files in order to display to the user. So you should "take" these files from the root directory since you want to list the contents of the folder. Usually these are the files:

index.php index2.php default.php index.html index.htm

You can configure this in the same Apache file that we changed earlier. Just look for the configuration:

<IfModule dir_module>
    DirectoryIndex index.php index2.php default.php index.html index.htm
</IfModule>

I do not recommend changing this, but if you want to, that's it!

    
29.12.2018 / 15:58