Im on windows 10, trying to customize an url to use Laravel. I dont want to acess the url using public folder on it. Im using wamp and apache is running on port 8080. So I edit the file wamp\bin\apache\apache2.4.23\conf\extra\httpd-vhosts.conf like this:
<VirtualHost *:80>
DocumentRoot c:/wamp/www/
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot c:/wamp/www/laravel_test/blog/public
ServerName laravel_test.dev
</VirtualHost>
After that, I edit the file system32/drivers/etc/hosts with:
127.0.0.1 localhost
127.0.0.1 laravel_test.dev
And when I access the url laravel_test.dev it doesnt work. I tried to use this too on httpd-vhosts.conf:
<VirtualHost *:8080>
And it doesnt work either. I always restart the service on wamp, and nothing changes.
I couldnt install and configure the homestead properly, so im trying to use wamp now. Can somebody help me?
In your httpd.conf file you need to uncomment the virtual Hosts section
Then,
Your vhost needs to listen on port 8080
<VirtualHost *:8080>
ServerName laraveltest.dev
ServerAlias www.laraveltest.dev
DocumentRoot c:/wamp/www/laravel_test/blog/public
<Directory "c:/wamp/www/laravel_test/blog/public">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
For your hosts file
127.0.0.1 laraveltest.dev www.laraveltest.dev
Related
I know I'm probably missing something simple, but I've exhausted all resources trying to get this working.
I'm running my Apache on Port:5000 and trying to direct to lsapp.dev instead of http://localhost:5000/lsapp/public/ with:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/lsapp/public"
ServerName lsapp.dev
</VirtualHost>
I have tried VirtualHost *:5000 but still can't get it work?
you can use this on command line in your project root
php artisan serve --port=your_port_number
or do this:
edit httpd-vhosts.conf that is located in C:\xampp\apache\conf\extra\httpd-vhosts.conf and add following lines at the end of the file:
# VirtualHost for LSAPP.DEV
<VirtualHost lsapp.dev:80>
DocumentRoot "C:\xampp\htdocs\lsapp\public"
ServerAdmin lsapp.dev
<Directory "C:\xampp\htdocs\lsapp">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
our apache is listening to lsapp.dev connections, but we have to configure our hosts file that allows to redirect lsapp.dev to the localhost that is located in C:\Windows\System32\drivers\etc
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 lsapp.dev
Set your Virtual host file like this.
<VirtualHost *:80>
DocumentRoot "D:\laravel Task\laravel\blog" //here set your project storage path
ServerName localhost.test.com // set your url for your project
<Directory "D:\laravel Task\laravel\blog"> // again set your project storage path
AllowOverride All
Order allow,deny
Allow from all
Require all granted
set your hosts file like this
127.0.0.1 localhost.test.com
Now you can Run your project
localhost.test.com
//OR//
If you dont want to use virtual host, then you can run your project like this
goto your project folder=>
command line in your project root=>php artisan serve
your project will run in
http://127.0.0.1:8000/
I just started learning php and I am trying to host locally my own php website by using XAMPP.
I wanted to create virtual host with:
URL: myphpwebsite.local
Port: 8088
But when I attempted to access this website through the browser I got a:
Not Found
HTTP Error 404. The requested resource is not found.
Does anyone know what the problem is?
My httpd-vhosts.conf
NameVirtualHost 127.0.0.1:8088
<VirtualHost 127.0.0.1:8088>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost myphpwebsite.local>
DocumentRoot "C:/Microsoft/Workspace/myphpwebsite"
ServerName myphpwebsite.local
ErrorLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.error.log"
CustomLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.custom.log" combined
<Directory "C:/Microsoft/Workspace/myphpwebsite">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And my C:\Windows\System32\drivers\etc\hosts file:
127.0.0.1 localhost
127.0.0.1 myphpwebsite.local
Any help would be appreciated!
make sure there's file/htaccess/index or whatever in directory you want to open, 404 may comes from that ;)
try using one below, eventually replace your port:
<VirtualHost *:80>
DocumentRoot "C:/Microsoft/Workspace/myphpwebsite"
ServerName myphpwebsite.local
</VirtualHost>
the question is your Apache running/serving on port 8088?
For example my xamp is running on 80 and 443...
xamp control panel is very handy, it has nice logs button that will open your log files to show you php and apache errors etc. check it out.
Try going with default port, if it works it means that you need to play with ports if you really want to.
just a quick tip, .com is shorter than .local and if you're using chrome and it works like mine then most of the time something.local will redirect you to google search (and I like my search there, you can switch it off ;))
I don't know if I am much help, but using WAMP, here are my settings. I am listening on port 80, I use 8080 for my tomcat server.
hosts file
127.0.0.1 local.mysite.com
httpd-vhosts.conf
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
....
<Directory "c:/wamp/www">
Options Indexes MultiViews FollowSymLinks
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
<VirtualHost *:80>
ServerName localhost
DocumentRoot "c:/wamp/www"
</VirtualHost>
<Directory "c:/wamp/www/path/to/site/root">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName local.mysite.com
DocumentRoot "c:/wamp/www/path/to/site/root"
ServerAdmin me#email.com
ProxyPreserveHost Off
RewriteEngine On
AllowEncodedSlashes NoDecode
#AllowEncodedSlashes On
ErrorLog "c:/wamp/www/path/to/logs/error.log"
CustomLog "c:/wamp/www/path/to/logs/access.log" common
</VirtualHost>
....
Then I can access my local site like this: http://local.mysite.com
Hope this helps...
The NameVirtualHost directive needs to match the value of VirtualHost exactly, and you need to specify the port in each instance. If you want to use port 8088 for myphpwebsite.local, you'd need to do:
NameVirtualHost 127.0.0.1:8088
<VirtualHost 127.0.0.1:8088>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1:8088>
DocumentRoot "C:/Microsoft/Workspace/myphpwebsite"
ServerName myphpwebsite.local
ErrorLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.error.log"
CustomLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.custom.log" combined
<Directory "C:/Microsoft/Workspace/myphpwebsite">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Notice the VirtualHost opening tags are identical; it's the ServerName value that actually tells Apache which domain this particular directive applies to. Restart your server after making the changes. Check out this page for more information: http://httpd.apache.org/docs/2.2/vhosts/name-based.html
Hope this helps!
Make sure that the port you are using is not being used by another service.
I’m having a hard time getting multiple sites working with MAMP using Virtual hosts. Below is what I have set up on my MBA. If I open up my web browser and go to "http:local.login.dev" or "http://dev.login.localhost" (after reconfigure) I get the index page that’s saved in /Users/aaron/localhost. First item listed in my Virtual hosts section Not the index page saved in the Virtual Host I want to get to. Other sites I have setup give me the same result.. "http:next.site.localhost" = displays the index page in /Users/aaron/localhost.
Does anybody have any thoughts? My final goal is to configure MAMP Virtual hosts to work and test with SSL.
Bottom line is it seems like ONLY the first Virtual host entry is read and that's whats used for every host listed. Am I missing some setting somewhere??
Environment:
- MBA with OS X, Yosemite
MAMP 3.0.7.3 using ports 80, and 3306 for http and mysql respectively
httpd.conf File:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
127.0.0.1 localhost
127.0.0.1 local.login.dev
<VirtualHost *>
DocumentRoot "/Users/aaron/localhost"
ServerName localhost
</VirtualHost>
<VirtualHost *:80> — I tried both with and without :80
DocumentRoot "/Users/aaron/localhost/training/login/public"
ServerName local.login.dev
</VirtualHost>
Also tried configuring my hosts and httpd-vhosts.conf this way - From another post:
127.0.0.1 localhost
127.0.0.1 dev.login.localhost
<VirtualHost *>
DocumentRoot "/Users/aaron/localhost"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/aaron/localhost/training/login/public"
ServerName dev.login.localhost
ServerAlias dev.login.localhost
<Directory "/Users/aaron/localhost/training/login/public">
Allow from All
AllowOverride all
Options -Indexes +FollowSymlinks
</Directory>
</VirtualHost>
Just playing around more I commented out the first "Localhost" in my httpd-vhosts.conf file and looks like I can now navigate to my local sites correctly. Below is what I currently have configed..
httpd-vhosts.conf:
# <VirtualHost *>
# DocumentRoot "/Users/aaron/localhost/"
# ServerName localhost
# </VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/aaron/localhost/training/login/public"
ServerName dev.login.localhost
ServerAlias dev.login.localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/aaron/localhost/site1"
ServerName dev.site1.localhost
ServerAlias dev.site1.localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/aaron/localhost/site2"
ServerName dev.site2.localhost
ServerAlias dev.site2.localhost
</VirtualHost>
Hosts File:
127.0.0.1 localhost
######Locahost Dev Sites
127.0.0.1 dev.login.localhost dev.site1.localhost dev.site2.localhost
Now to see if I can get SSL working.
If any of this is incorrect, please let me know... but this config is the only way I can get the Virtual hosts working, as of now, using port 80... If I have issues mixing with 443 I'll update
I have installed wamp a handful of times, and have it working on my local environment. Currently I am attempting to resolve an issue on a server of mine which is running wamp. I uninstalled a working copy, and now when I attempted to reinstall I have been unsuccessful. I have changed the port to be 8080 and have configured the httpf.config to do so.
ServerName 50.56.176.95:8080
ServerRoot "C:/wamp/bin/apache/apache2.4.9"
Listen 50.56.176.95:8080
<virtualHost *:8080>
DocumentRoot "c:/wamp/www/Hi"
ServerName 50.56.176.95
</virtualHost>
<virtualHost *:8080>
DocumentRoot "c:/wamp/www/Hi"
ServerName 50.56.176.95
<directory "c:/wamp/www/Hi">
Order allow,deny
Allow from all
Require all granted
</directory>
</virtualHost>
Wamp turns on and apache and php start up, however if I attempt o access 50.56.176.96:8080 I will get a 404 error.
Something to note is that everything is commented out in the htacces file in the www directory.
Should the ServerName not actually be a name and not an ip address?
Also you are using Apache 2.2 and Apache 2.4 access control syntax in the same VH def? As you are using Apache 2.4 it may be best to stick to 2.4 syntax.
So maybe this will work :-
<VirtualHost *:8080>
DocumentRoot "c:/wamp/www/Hi"
ServerName hi.com
ServerAlias www.hi.com
<Directory "c:/wamp/www/Hi">
Require all granted
</Directory>
</VirtualHost>
I am trying to install magento on a virtual host in my system running with XAMPP
I have done following till now :
Added lines in the hosts file under windows/system32/driver/host
192.168.1.69 magento2.hue
192.168.1.69 www.magento2.hue
Then added code in httpd-vhosts.conf in XAMPP folder
NameVirtualHost 192.168.1.69:80
<VirtualHost magento2.hue>
ServerAdmin magento2.hue
DocumentRoot "C:/www/mag_domain2/httpdocs/"
ServerName magento2.hue
ServerAlias www.magento2.hue
ErrorLog "C:/www/mag_domain2/httpdocs/error.log"
CustomLog "C:/www/mag_domain2/httpdocs/access.log" combined
<Directory "C:/www/mag_domain2/httpdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Restarted Apache and Mysql, but the site i.e magento2.hue is not loading.
Can you please figure out if i am doing something wrong here ?
try with below httpd.conf setting it working at my end
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/yourmagentosetup"
ServerName magento2.hue
</VirtualHost>
hope this will sure work for you.
Oh my,
I just figure it out.. i have previously added another vhost which points to 192.168.1.59 and is working fine
I just needed to point new one to the same IP and change the ServerName to magento2.hue instead of magento.hue as was of previous one.
it works now.
Thanks liyakat and Arjun for viewing this question.