Create virtualhost in windows (apache in Ubuntu)

Asked

Viewed 300 times

3

I’m trying to set up mine apache to access a folder in my HD with windows, have 2 hds on the machine, a ubuntu and the other the windows.

The apache already installed, including I have created the file:

/etc/apache2/sites-avaliable/vip.localhost.conf 

I added the lines:

   ServerName vip.localhost
   ServerAlias vip.localhost
   ServerAdmin webmaster@localhost
   DocumentRoot /media/name/2E4C85684C852BA1/development
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log

And I also made the alteration in the hosts, but when I try to access vip.localhsot I get the code:

403 Forbiden

In case it says I don’t have access to this directory.

Does anyone have any idea what I have to do? Do I need to assemble a folder in the ubuntu so that he can access my files? If so, how do I?

  • 403 means access denied, there are conditions to provide the necessary permissions for that folder?

  • Probable cause is the lack of access permission that is in Ricardo’s response (configured in the Directory tag). It was strange the lack of tags in the configuration, but I don’t know how the structure of includes, maybe they were omitted just to post here.

2 answers

2

First of all, make sure you mount your Windows hard drive, he has permission to read and write for the user www-data, which is the user that Apache runs on Ubuntu.

Then create a file in /etc/apache2/sites-avaliable/seuvhost.conf and the content has to look like this one (for Apache 2.4.X):

<VirtualHost *:80>
    DocumentRoot /media/name/2E4C85684C852BA1/development
    ServerName yourserver.example.com

    <Directory /media/name/2E4C85684C852BA1/development>
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Once done, enable this new Virtualhost with the command:

sudo a2ensite seuvhost

And restart the Apache:

sudo service apache2 restart

1

Another solution is to have a server complete with XAMPP(lampp). only install the shaman

Dai just start the server and make the settings in Virtualhost.

Browser other questions tagged

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