I'm using the Xampp tutorial to set up virtual hosts. My httpd-vhosts.conf looks like this...
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs/www/mysite/public_html"
ServerName mysite.com
</VirtualHost>
My hosts entry looks like this..
127.0.0.1 mysite.com
The hosts part is working because mysite.com lands me on the Apache dashboard (mysite.com/dashboard).
I have the Apache server on 8080, and can browse to my site manually with http://127.0.0.1/www/mysite/public_html/
I've tried the virtual hosts config with 80 and 8080.
How can I get it to land on my site?
Edit: On my console (checking syntax) # httpd.exe -t Syntax OK
Related
I want to set up 2 virtual hosts on my local xampp environment, I have two different WordPress websites with URLs
test.com and
test.com/blog
Now I want to set up vhosts for local like
test.local and
test.local/blog
test.local works but test.local/blog redirects to test.local's 404 page
xampp vhosts configuration:
<VirtualHost *:80>
DocumentRoot "/xampp/htdocs/test.com"
ServerName test.local
</VirtualHost>
<VirtualHost *:80>
ServerName test.local/blog
DocumentRoot "/xampp/htdocs/blog-test.com"
</VirtualHost>
hosts file setup:
127.0.0.1 test.local
127.0.0.1 test.local/blog
ServerName can be used for 2 or more different domains when configuring virtual hosts.
You do not have different domains.
test.com and test.com/blog are the same domain.
Similarly
test.local and test.local/blog are the same domain
Iam trying to make virtual host for laravel 5.2 in apache server, but everytime i tried to access the virtual host it always shows "This site cant be reached", but i can access it through localhost:folder/public
I already setting the httpd-vhost
<VirtualHost *:80>
DocumentRoot "C:/xampp2/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp2/htdocs/belajarlaravel/public"
ServerName belajarlaravel.dev
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp2/htdocs/merchandise3-project/public"
ServerName merchandise.dev
</VirtualHost>
and my host
127.0.0.1 localhost
127.0.0.1 belajarlaravel.dev
127.0.0.1 merchandise.dev
I can access the localhost but for other host they still showing server not found and site cannot be reached. Can u give me some advice ? Thank You for your attention.
maybe the .dev ending is considered unsafe by Chrome, try .com
I'm having trouble getting Virtual Hosts to work on MAMP.
Here's my hosts file:
127.0.0.1 localhost
127.0.0.1 mysite
Here's my httpd-vhosts.conf file:
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# Custom Virtual Hosts
#
<VirtualHost *:80>
DocumentRoot "/Users/(username)/Documents/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/(username)/Documents/foo/bar/"
ServerName mysite
<Directory "/Users/(username)/Documents/foo/bar/">
AllowOverride all
</Directory>
</VirtualHost>
My httpd.conf looks like this:
# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
http://mysite doesn't work. I restarted the apache servers multiple times. I've taken a look into multiple threads on this subject on here, but I can't figure out what's wrong.
EDIT: btw, I'm using /Users/(username)/Documents as my document root for MAMP, maybe I should replace those with the usual /Applications/MAMP/htdocs anyway ?
Check that the ports you set for apache is what you set in your httpd-vhosts.conf file. If its port 80. it should be same in your Mamp apache port.
Hi I would like to ask some help on setting up my webserver to access over my network.
Basically I have more projects on the www folder. For example I have 2 website that I want to access on different machine.
Heres my vhost config.
NameVirtualHost *:80
<VirtualHost *:80>
ServerName website1
ServerAlias website1
DocumentRoot "/www/website1"
</VirtualHost>
<VirtualHost my_ip_add:8080>
ServerName website2
ServerAlias website2
DocumentRoot "/www/website2"
</VirtualHost>
And I also configure the /etc/hosts file.
127.0.0.1 localhost
127.0.0.1 website1
my_ip_add website2
What I want to is to access website2 from other machine.
What happen is when I put http://my_ip_add:8080/ on my browser it was "ERR_CONNECTION_REFUSED", but when I use http://my_ip_add/ it render website1.
How can I access the website2 on other machine? Is there is missing on my configuration?
I hope someone can help me on this. Thanks in advance.
Why so complex? Why don't you deliver both sites on the same port? That is what virtual hosts are for. You only have to take care to always request the two sites by their host name as resolved in your local name resolution...
Simplify your virtual hosts definition:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName website1
DocumentRoot "/www/website1"
</VirtualHost>
<VirtualHost *:80>
ServerName website2
DocumentRoot "/www/website2"
</VirtualHost>
Your local name resolution should resolve both host names:
127.0.0.1 localhost
my_ip_add website1
my_ip_add website2
now you can make these requests from all systems with above name resolution:
http://website1
http://website2
I was wondering how I would go about setting up the virtual hosts so that I just have to enter www.mydomain.com:9090 to go to phpmyadmin. This is how I have my vhosts set up right now in httpd.conf:
<VirtualHost *:80>
DocumentRoot /var/www/html/
ServerName mydomain.com
ServerAlias www.mydomain.com
</VirtualHost>
<VirtualHost *:9090>
DocumentRoot /usr/share/phpMyAdmin/
ServerName mydomain.com
ServerAlias www.mydomain.com
</VirtualHost>
This does not seem to be working.
Have you tried adding... Listen 9090 to your config?
Add the new Virtual host in /etc/httpd/conf.d/localhost.conf and then edit httpd.conf in /etc/httpd/ to listen to new port. Restart httpd and then opened the port in IPtables. Apply the new rules.