Configure virtual host on Ubuntu

Asked

Viewed 356 times

1

I’m trying to set up the virtual host on my Deepin OS and nothing I did works. Before you mark the question as duplicate, all the alternatives I saw here on the forum I tried and did not succeed, I saw several and several videos on youtube and tbm does not work. Currently my virtualhost is like this

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName gymdoctor.dev
    ServerAlias www.gymdoctor.dev
    DocumentRoot /var/www/gymdoctor.dev/public/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I have tried also with directory options and point to the public folder of the project in Laravel and nothing. Does anyone know any way to solve this or the problem is in the OS that I use since all the tutorials for Ubuntu I tried.

SOLVED: I was using meusite.dev to create vhost, switched to meusite.test and it worked correctly.

  • Which Apache file did you edit exactly? And in which folder? Apache installation was via apt-get or installed something independent of the official repository? Give details so that we can know what you did and so be able to guide you.

  • apache was installed via apt-get. The files I edited was in the /etc/apache3/sites-available/meusite.dev folder <VirtualHost *:80>&#xA; ServerName meusite.dev&#xA; ServerAlias www.meusite.dev&#xA; ServerAdmin [email protected]&#xA; DocumentRoot /var/www/gymdoctor/public&#xA; ErrorLog ${APACHE_LOG_DIR}/error.log&#xA; CustomLog ${APACHE_LOG_DIR}/access.log combined&#xA;</VirtualHost> and on/etc/hosts I just added 127.0.0.1 meusite.dev

  • you added in hosts the address meusite.dev to point to 127.0.0.1?

  • Yes, I did. In Chrome it doesn’t work and in firefox it takes the index of the folder /var/www/html and not /var/www/meusite.dev/public

  • Felipe I answered

1 answer

1

Change the extension to:

/etc/apache3/sites-available/meusite.dev

To .conf

/etc/apache3/sites-available/meusite.dev.conf

The same for:

/etc/apache3/sites-available/gymdoctor.dev

To .conf

/etc/apache3/sites-available/gymdoctor.dev.conf

Extra notes:

The notes here are for future visitors:

Don’t forget to add in hosts, for this edit the file /ect/hosts (probably requires sudo), an example if you have the nano:

sudo nano /etc/hosts

Then let it resemble this:

127.0.0.1   localhost
127.0.1.1   meusite.dev

Browser other questions tagged

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