Jump to content

set up vhost on my machine

- - - - -

  • Please log in to reply
13 replies to this topic

#1
AdrianWierciochPHP

AdrianWierciochPHP

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
Hi again!
I have to set up virtual host on my machine but it is Ubuntu LTS 10.0.4 or somethings like. I saw a lot of tutorial to it but my vhost is not working. When i try to type address my browser not see it. I write full apache code look like this:

<VirtualHost *:80 >

        #Basic setup

        ServerAdmin webmaster@mydomain.local

        ServerName www.dev.mydomain.local

        DocumentRoot /home/www/mydomain.com/docs


        <Directory /home/www/mydomain.com/docs>

                Order Deny,Allow

                Allow from all

        </Directory>

</VirtualHost>

And I type in hosts in /etc/ something like
127.0.0.1 mydomain.local

and nothing is working :(

please help me :)

#2
AdrianWierciochPHP

AdrianWierciochPHP

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
I will describe which tutorial I used and what I did to install vhost:

Tutorials:

So first I wrote mydomain.conf file which look like above and i saved it in /etc/apache2/sites-available/ , I went to /etc/apache2/sites-enabled/ by cd command I did link to above file by ln command. Next I reloaded apache engine by terminal and check status, which was good. So i typed in browser address and tried to connect, but it was not working and I don`t know why.
I don`t know if I should write here this post, but on ubuntu nobody answered my so I write it here, because I think that each of you had to configure your apache once.

#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
Hi, did add this to your /etc/hosts file?
127.0.0.1 localhost.localdomain mydomain.local
And access http://www.dev.mydomain.local/ in browser?

Edited by Alexander, 01 January 2011 - 06:40 PM.

Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#4
Roger

Roger

    If nothing goes right, go left.

  • Administrators
  • 718 posts
  • Programming Language:C, PHP
  • Learning:Python
Just some thoughts..

I think

<Directory /home/www/mydomain.com/docs> 

should be

<Directory /home/www/mydomain.com/docs/> 

with a slash at the end.

Did you enable the site using a2ensite?
Check out our update Guidelines/FAQ. When posting code, remember to use code tags - Posted Image.

#5
AdrianWierciochPHP

AdrianWierciochPHP

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
Thank you so much, now it is fully working, I should just add line : "127.0.0.1 localhost mydomain.local" in my /etc/hosts file :)

#6
Roger

Roger

    If nothing goes right, go left.

  • Administrators
  • 718 posts
  • Programming Language:C, PHP
  • Learning:Python
was the fix /etc/hosts or the trailing slash? Can you post your working version?
Check out our update Guidelines/FAQ. When posting code, remember to use code tags - Posted Image.

#7
AdrianWierciochPHP

AdrianWierciochPHP

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
I had to fix /etc/hosts and slashes but I have new problem. First vhost worked and I tried to set second but when I reloaded apache I saw this message:
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

So I delete all vhosts file and when I reload again I see this message again. I wrote very simple vhost file which worked but don`t worked when I did next vhost, this look like this:
<VirtualHost *:80>
ServerName www.zend.local
DocumentRoot /home/adrian/www/zend/public/
</VirtualHost>

I have not to type Directory tags, because this directory do not require permission.

#8
AdrianWierciochPHP

AdrianWierciochPHP

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
I don`t know what I did but all is working. I`m just different :p

#9
Roger

Roger

    If nothing goes right, go left.

  • Administrators
  • 718 posts
  • Programming Language:C, PHP
  • Learning:Python
That's cool.
Check out our update Guidelines/FAQ. When posting code, remember to use code tags - Posted Image.

#10
AdrianWierciochPHP

AdrianWierciochPHP

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
I have one more question: when I access in my browser site`s address I see don`t changed page, but when I type in terminal:
php index.php
and access again page is actually. It minds when I change my index.php file and try to see it in browser I see page before it was changed, but when I see index.php in terminal and reload browser I see page after changed. I don`t understand it.

#11
Roger

Roger

    If nothing goes right, go left.

  • Administrators
  • 718 posts
  • Programming Language:C, PHP
  • Learning:Python
Did you refresh the page? Or are you seeing a cache page?
Check out our update Guidelines/FAQ. When posting code, remember to use code tags - Posted Image.

#12
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
Hi,

Are you sure you are editing the proper index.php page, such as in /home/adrian/www/zend/public/index.php ?

Can you restart Apache and see if this problem still persists?

Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users