Open project with Localhost - Ubuntu

Asked

Viewed 4,332 times

2

I’ve searched all day and I’ve asked a lot of people for help but I can’t find what I’m really looking for.

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

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

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

  • Already exprerimentou put only localhost to check if the default Apache page appears?

  • Yes Giancarlo, yes appears the "Apache2 Ubuntu Default Page It’s Work!"

  • enters the /var/www folder and executes the sudo chmod -Rf 777 folder name command. Another thing is to remove the index.php or index.html file from the var/www folder. So Voce can look at the directory inside the localhost. Check it out:https://netbeans.org/kb/docs/php/configure-php-environment-ubuntu_pt_BR.html

  • I have the solution to your problem. Take a look at my answer ;)

  • in some Ubuntu the folder is /var/www/html, and you must access http://localhost to access the folder /var/www/html and not access this directory in the browser, I understood that Voce tried this

1 answer

2

In Ubuntu, apache, with its default settings, does not run the folders inside var/www, and yes the ones inside var/www/html.

Place the files or folders inside 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.

This is what I usually do.

  • I create a file .conf inside the briefcase sites-avaliable. In that case, let’s create /etc/apache2/sites-avaliable/minha_pasta.conf.

  • I confirm 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 command a2ensite to enable it in apache.

Example:

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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.