XAMPP Virtual Host cant find? - apache

I'm trying to set up a local development environment for a PHP project. The project is placed in the htdocs folder, and i wanna be able to access it on a virtual host environment so all the links and so on works, and treats it as the root directory.
So, here is what i have done:
C:\Windows\System32\drivers\etc
hosts
127.0.0.1 bakeboss.test
C:\xampp\apache\conf\extra
httpd-vhosts
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\bakeboss"
ServerName bakeboss.test
<Directory "C:\xampp\htdocs\bakeboss">
</Directory>
</VirtualHost>
Apache starts up fine, but if i try to go to (in my browser):
www.bakeboss.test
NOTHING happens - cannot find it, cannot connect. If i go to localhost/bakeboss it works, but obviously not the way i want it.
What am i missing here?

Related

VHost is showing only "it works" instead of project pages

I've developed virtual hosts in my mac but instead of showing the project its showing "it works".
I have a java application, this is my httpd-vhosts.conf:
<VirtualHost *:8080>
DocumentRoot "/Users/lalarukh/data/code/prestige-apis"
ServerName labraize.in
<Directory "/Users/lalarukh/data/code/prestige-apis">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
etc/hosts file:
127.0.0.1 labraize.in
Uncommented the required lines also in httpd.conf file.
For testing purpose I made a directory in my server folder named test. And made index.html file inside. And called it in hosts as http://test.com But it also returned "It works".
Means that apache vhosts can't get inside the code directory that's why its not working.
vhosts showing 'it works' instead of project pages.
The vhost is listening on port 8080 and not the default 80 so if you want to reach the correct vhost, you need to add :8080 at the end of the URL so in theory: http://labraize.in:8080 should work.

XAMPP Virtual Host wildcard subdomains on Mac

I want to set up my virtual hosts in a way so that I don't have my projects in the htdocs folder and I would like to use subdomains to get to them. So for example instead of going to "http://localhost/myproject" which would be located inside "/xampp/htdocs/myproject", I'd rather like to go to "http://myproject.sites.local" which would be located inside "/Users/myname/Projects/myproject".
I know I have to go to httpd.conf inside the "etc" folder in xampp and uncomment the line that includes virtual hosts, done that. Then I went to "/etc/hosts" file to add "127.0.0.1 sites.local" and after that I have this chunk of code inside my httpd-vhosts.conf file:
<Directory "/Users/marioplantosar/Projects">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Virtualhost *:80>
VirtualDocumentRoot "/Users/marioplantosar/Projects"
UseCanonicalName Off
</Virtualhost>
<Virtualhost *:80>
VirtualDocumentRoot "/Users/marioplantosar/Projects/%1"
ServerName sites.local
ServerAlias *.sites.local
UseCanonicalName Off
</Virtualhost>
The first part works I guess because if I visit "http://sites.local" it opens the Projects folder root (it just lists the subfolders because there is no index file inside of the "Projects" folder. But the other part is not working and it just throws the "ERR_NAME_NOT_RESOLVED" error. So I have the wildcard "*" in the ServerAlias so that it catches every subdomain of sites.local, and I use the "%1" to open the corresponding folder inside "Projects" folder, however it's just not working. The weirdest part is that it worked for months up until yesterday and I have no idea what happened that it just suddenly stopped working.
I figured out the problem. Everything I wrote in the question was configured correctly, but since I was doing all of that little over a year ago I totally forgot about the dnsmasq part which somehow got messed up. "hosts" file doesn't support wildcards so you have to use a tool like dnsmasq that does the dns masking automatically for every folder inside my "Projects" folder.
For anyone that gets into a similar situation like me, you configured everything in httpd-vhosts.conf, httpd.conf and hosts files correctly but it's not working you should follow this tutorial to set up the dnsmasq: https://passingcuriosity.com/2013/dnsmasq-dev-osx/

Apache: 3 virtual hosts working perfectly, 1 is not, but settings seem to be the same (Mac)

(OSX Leopard 10.5.8)
I've been using virtual hosts with no problems until now, when I tried to make a new block of code for the next one. The offender is called project1.
I've got an index.php sitting in the project1/html/ folder, just like all the others. But every time I try to go to http://project1/ in the browser I get a 404.
Here's the contents of httpd-vhosts.conf:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Users/sebu/_SERVER/"
</VirtualHost>
<VirtualHost *:80>
ServerName skeleton
DocumentRoot "/Users/sebu/_SERVER/skeleton/public_html/"
</VirtualHost>
<VirtualHost *:80>
ServerName pickle
DocumentRoot "/Users/sebu/_SERVER/pickle/"
</VirtualHost>
<VirtualHost *:80>
ServerName project1
DocumentRoot "/Users/sebu/_SERVER/project1/html/"
</VirtualHost>
Here's what I've checked already:
I restarted Apache (every time I change something).
I tried clearing the browser cache.
I tried rebooting.
I made sure the file permissions are exactly the same as the other working vhosts (dirs and files).
I've got the line Options Indexes +FollowSymLinks -MultiViews in httpd.conf (turning Multiviews off was the solution to an earlier problem).
I ran httpd -S to check the syntax and it said everything was OK.
I tried pinging project1 just to check and sure enough it says cannot resolve project1: Unknown host
(Not sure if it's worth mentioning, but when I did a ls -la in _SERVER/ I noticed that project1/ had permissions written as drwxr-xr-x# with the # on the end. I read that this meant it was a quarantined file and would wait for me to open it so I ran open project1/ and it went away.)
do you have an entry in /etc/hosts for skeleton, pickle, but not project1? If so, add an entry for project1 and that should resolve your issue.

How to add a virtual host on a folder that is located on another computer?

I have Zend Server installed on my machine (windows 7 home edition) and I´m trying to set up a virtual host on a folder that is located in our server. For some reasons, I can't set an apache web server in there, so it must be done in my own computer.
But I can't get it done. My virtual host setup in httpd-vhosts.conf is like this:
<VirtualHost *:8081>
ServerAdmin web#web.com.br
DocumentRoot "\Data\Websites\Online\TheClientName\Site"
ServerName clientname.local
ServerAlias clientname.local
ErrorLog "logs/clientname.log"
</VirtualHost>
And the hosts file:
172.17.10.1/Data/Websites/Online/TheClientName/Site clientname.local
I have checked the Apache log. There's a Warning:
Warning: DocumentRoot [C:/Data/Websites/Online/TheClientName/Site] does not exist
I got full access to this folder, and I have it mapped like a local drive. I tried to set the DocumentRoot as follows, but no luck; Apache does not restarts after setting the 'Z:\'.
"Z:\Data\Websites\Online\TheClientName\Site"
I wonder if there is a way to point this v-host to server folder. Any ideas?

Zend Http conf setting to Windows 7

I'm following Zend beginner tutorial. In that actually following need to be setup in the local server Apache httpd.conf in Linux PC.
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/usr/local/apache/htdocs/square/public"
ServerName square.localhost
</VirtualHost>
But I've a Windows 7 installed with Xampp in my local. Could anyone please help me on this how to put this in my local httpd.conf file.
Change DocumentRoot "/usr/local/apache/htdocs/square/public" to a public folder of your project. For example, to "C:\XAMPP\www\square\public" or wherever your project's public folder is located.
Also make sure you have this line in your hosts file : 127.0.0.1 localhost