Re: Unable to set up virtual hosts on Mac

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> Date: Monday, March 21, 2016 13:31:27 +0100
> From: Roparzh Hemon <roparzhhemon@xxxxxxxxx>
>
> "I suspect you are mixing concepts (servername vs. documentroot),
> and likely not fully understanding what a virtualhost is and how one
> would access it via a web server. Do you control the domain
> "strawberry.com", or is this just an obscured reference to the real
> domain you are using?"
> 
>     That's what I'm suspecting too, I must admit. So correct me if
> I am wrong : isn't the whole point of virtual hosts to emulate the
> behavior of websites on faraway servers while actually residing
> wholly on your personal computer ? I do not own any public domain
> called "strawberry.com", but I don't need to during the development
> phase of my site, correct ? Only when I wish to make the site
> public will I need to get a domain.
> 


The/an intent of the virtual host capability in a web server is to
allow one to run multiple sites on the same machine and under the
same [in this case apache] web server instance (with or without their
own IPnumbers). What you do with this capability is up to you. Using
it for development is a case - that way you can do a setup that
matches a production site, but it is also heavily used in various
forms of shared hosting environments.

Generally you should avoid using existing domain names, especially
ones you don't control, (e.g., strawberry.com) since that can have
confusing repercussions. 


> "You need to "show your work", i.e., at least the relevant parts of
> your virtualhost configuration and the directory list showing the
> documentroot for this virtualhost."
> 
>  To answer the directory list question :
> 
> :Documents/Sites$ ls -R www.strawberry.com/
> index.html    public_html
> 
> www.strawberry.com//public_html:
> index.html
> 
> To answer the configuration question : I edited three files, whoses
> contents follow below.
> 
> Contents of /private/etc/hosts file :
> 
> 127.0.0.1 localhost
> 127.0.0.1 strawberry.com www.strawberry.com
> 255.255.255.255    broadcasthost
> ::1             localhost
> 
> 
> <VirtualHost *:80>
>     ServerName strawberry.com
>     ServerAlias www.strawberry.com
>     DocumentRoot "/Users/myusernamehere/Sites/strawberry"
> </VirtualHost>
> 
> 
> 
> On Mon, Mar 21, 2016 at 1:07 PM, Richard wrote:
>> 
>> 
>> ------------ Original Message ------------
>>> Date: Monday, March 21, 2016 08:50:05 +0100
>>> From: Roparzh Hemon <roparzhhemon@xxxxxxxxx>
>>> 
>>> I've tried to set up a virtual host on my Mac, following all the
>>> instructions at
>>> https://coolestguidesontheplanet.com/how-to-set-up-virtual-hosts-
>>> in -apache-on-mac-osx-10-11-el-capitan/.
>>> 
>>> But when I type localhost/~myusernamehere/www.strawberry.com in my
>>> browser, I get a "404 Not Found : The requested URL
>>> /~myusernamehere/www.strawberry.com was not found on
>>> this server." message
>>> 
>>> The output of "/usr/sbin/apachectl configtest" is "AH00112:
>>> Warning: DocumentRoot [/Users/ewandelanoy/Sites/strawberry] does
>>> not exist Syntax OK"
>>> 
>>> In my ~/Documents/Sites I have a directory called
>>> www.strawberry.com. Should I rename it to just "strawberry" ?
>> 
>> 
>> You need to "show your work", i.e., at least the relevant parts of
>> your virtualhost configuration and the directory list showing the
>> documentroot for this virtualhost.
>> 
>> I suspect you are mixing concepts (servername vs. documentroot),
>> and likely not fully understanding what a virtualhost is and how
>> one would access it via a web server.
>> 
>> Do you control the domain "strawberry.com", or is this just an
>> obscured reference to the real domain you are using?
>> 
>> 

If you've set your DocumentRoot to:

  DocumentRoot "/Users/myusernamehere/Sites/strawberry"

then that's where the server is going to delivery the content from.
It's not going to look in .../www.strawberry.com/... I'm assuming
that you have a real username in the "myusernamehere" slot.

Given what you've done with/to your /etc/hosts file, you should be
able to get to your content with:

   http://www.strawberry.com/

when you have the apache side set up correctly. I.e., you don't need
the "localhost/~username/www.strawberry.com" pathing.


[please don't top post.]



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux