Open project with Localhost - Ubuntu

2

I searched all day and asked for help from many people, but I did not find what I really wanted.

I need a step-by-step tutorial on how to open a project with apache in Ubuntu.

Apache2 is installed, mysql is installed and PHP5 is also installed.

I have tried to create a folder inside / var / www but if I type the localhost followed by the folder name the browser informs that the directory / file does not exist.

    
asked by anonymous 13.07.2015 / 22:52

1 answer

1

In ubuntu, apache, with its default settings, does not execute the folders that are within var/www , but those that are within var/www/html .

Place the files or folders within var/www/html , and the problem will be solved.

There is also a way to configure so that other folders can also be recognized by apache .

I usually do the following.

  • I create a .conf file inside the sites-avaliable folder. In this case, we will create /etc/apache2/sites-avaliable/minha_pasta.conf .

  • I check the file .conf :

Example - file /etc/apache2/sites-avaliable/minha_pasta.conf :

<VirtualHost *:80>
    ServerName 127.0.0.2
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/minha_pasta
</VirtualHost>
  • I use the a2ensite command to enable it in apache.

Example:

 a2ensite /etc/apache2/sites-avaliable/minha_pasta.conf

Then, restart apache by typing in the command line service apache2 restart

    
22.02.2016 / 13:41