I have recently purchased a new computer and I am trying to get my website to find laravel. I have installed both wamp and composer. I am able to create a new laravel project using composer create-project... I have made a VirtualHost and a hostname as such..
<VirtualHost *:80>
DocumentRoot /wamp/www/jaycousins/public
ServerName jaycousins
<Directory "/wamp/www/jaycousins/public">
Options +Indexes
AllowOverride All
Require all granted
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
127.0.0.1 jaycousins
But I cant find laravel simply by searching http://jaycousins/
I find it by http://localhost/jaycousins/public... How do i fix this?
You give full path of directory
<Directory "<< Directory Full path >>">
E.g.
<Directory "c:/wamp/www/jaycousins/public">
Wamp config Reference
https://www.kristengrote.com/blog/articles/how-to-set-up-virtual-hosts-using-wamp
Related
I use Windows 10 and XAMPP for local development. I want to create project on laravel 5.5 and access it in browser by project.dev
I add next lines to httpd-vhosts.conf file
<VirtualHost project.dev:80>
DocumentRoot "C:\xampp7\htdocs\server\laravel\project_name\public"
ServerAdmin project.dev
<Directory "C:\xampp7\htdocs\server\laravel\project_name">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
and
127.0.0.1 project.dev
to hosts file. But it does not work (only for laravel),I get 400 error.
This works with all the rest my local projects except those ones on laravel.
I have no problem with access to this project by
http://localhost/server/laravel/project_name/public
What other settings do I have to make to access laravel 5.5 project like project.dev?
1- change VirtualHost project.dev:80 to VirtualHost *:80
2- change ServerAdmin project.dev to ServerName project.dev
and after these changes restart your apache service
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 am a complete novice when it comes to WAMP, apache etc.
I'm trying to get a site to run locally but so far not having any luck. I've got as far as installing WAMP and it seems to be going online fine, i.e. the green "W" icon is green. Features like phpmyadmin seems to be working. When I click "localhost" it opens the browsers and navigates to localhost as you'd expect, however, all I see is the directory listing.
So, I have virutal hosts set up as follows:
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/bts/BiteTheSun"
ServerName bts
ServerAlias bts
<Directory "c:/wamp/www/bts/BiteTheSun">
Require all granted
</Directory>
</VirtualHost>
and in my hosts file I have:
127.0.0.1 localhost
127.0.0.1 bts
::1 bts
::1 localhost
I've added some images just to be clear as to the issue - the top image shows what I think I should be seeing and the bottom shows what I actually see:
localhost screenshot issue
I've tried everything I can think of to no avail. It might also help to mention that in the log file [apache_error.log] I seem to get errors relating to permissions:
"AH01630: client denied by server configuration: C:/Apache24, referer: http://localhost/"
However, I've gone through the permissions set in the config files using examples from several sources and nothing seems amiss.
Has anyone any idea what is going on here? I have searched online high and low on this and on one else seems to have exactly this issue which makes me think it is me doing something very silly - I just need someone to point out how exactly! :)
Richard
Is there an index file in your www folder?
Typically, you want to place your individual projects within the www folder and point your virtual hosts to the www/your-project/ folder which should contain an index.php file (unless you have a custom set up where you are going to point your virtual host directly to a specific file).
Your Virtual Host definitions are incomplete.
Each VH should have its own <Directory>...</Directory> definitions so you can apply the access and other config information to that directory.
The parts you are missing are AllowOverride and Options.
The other thing to remember is that when you create a Virtual Host environment the host defined in the httpd.conf file is basically ignored and the VH's take presidence. This is why you need to redefine the localhost in the VH file.
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/bts/BiteTheSun"
ServerName bts
<Directory "c:/wamp/www/bts/BiteTheSun">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
Your AH01630: client denied by server configuration: C:/Apache24 error is likely because the default httpd-vhost.conf file comes with 2 example definitions as supplied by Apache. These should be completely deleted from the file. So if you left these in the httpd-vhost.conf file. Delete them completely from the file.
Example of the defs to remove. Note they use the c:/Apache24 directory which does not, and should not exist in a WAMPServer environmant!
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
Currently I am using wamp on a windows machine and have kohana up and running for one site. I would like to deploy another site which is completely separate and uses a different copy of kohana. To do so I added file structure and deployed kohana as follows
+wamp
++www
+++site1
++++kohana
+++site2
++++kohana
Currently my apache httpd.conf listener is as follows
Listen 0.0.0.0:80
And my hosts file in the windows directory is set up as
127.0.0.1 localhost
127.0.0.1 site1.localhost
127.0.0.1 site2.localhost
Currently when I go to localhost it will go to site1.localhost. Or if i go to site1.localhost it will go to site 1. If I go to site2.localhost the application will redirect to site1.localhost
I am very new to LAMP so this may be a very basic issue, for that I apologize.
Creating a virtual host is the answer
<VirtualHost site1.localhost>
ServerAdmin webmaster#site1
ServerName site1
DocumentRoot "C:/wamp/www/site1"
<Directory "C:/wamp/www/site1">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/site1-error.log"
CustomLog "logs/site1-access.log" common
</VirtualHost>
<VirtualHost site2.localhost>
ServerAdmin webmaster#site2
ServerName site2
DocumentRoot "C:/wamp/www/site2"
<Directory "C:/wamp/www/site2">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/site2-error.log"
CustomLog "logs/site2-access.log" common
</VirtualHost>
I'm following this tutorial to learn how to start a project using ZendFramework
http://framework.zend.com/manual/1.12/en/learning.quickstart.create-project.html
When I get to setup a virtual host I get stuck. If I do exactly as the tutorial says, it shows me an error (in all my project, zend or not), says the file wasn't found.
Then I found this tutorial on StackOverflow very handy
Can't run zend framework MVC application on WAMP
Following what the guy on the bottom of the page says takes me to the same error when I try to access my app as zendProject.local/
This is what I got
on hosts (Windows/System32/drivers/etc/hosts) file
127.0.0.1 blog.local
on httpd-vhosts.conf file
<VirtualHost 127.0.0.1>
ServerName blog.local
DocumentRoot /blog/public
SetEnv APPLICATION_ENV "development"
<Directory /blog/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Can you tell me what I am doing wrong? The browser still says Not Found The requested URL /public was not found on this server when I go to http://blog.local/
I'm running WAMP on Windows. And this is the absolute path to the 'blog' project C:\wamp\www\blog
#Edit RiggsFolly
this is what I got now in the httpd-vhosts.conf file
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www">
AllowOverride All
# make sure this is only allowed to be accessed by the local machine
# then if/when you open one of your other sites up to the internet and somebody uses your IP
# they will get directed here as its the first VH def and then receive a 403 not allowed to access
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName blog.local
DocumentRoot "C:/websites/blog/public"
Options Indexes FollowSymLinks
SetEnv APPLICATION_ENV "development"
<Directory "C:/websites/blog/public">
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
And I created a new directory at C:/ called 'websites' as you suggested
You need to be a little more specific with your folder locations. I guess this tutorial was written for Unix and you are using windows.
For Apache 2.2.x use this syntax:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName blog.local
DocumentRoot "C:/wamp/www/blog/public"
Options Indexes FollowSymLinks
SetEnv APPLICATION_ENV "development"
<Directory "C:/wamp/www/blog/public">
DirectoryIndex index.php
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
You would be better avoiding the Allow from all and using Allow from localhost 127.0.0.1 ::1 until you actually want to allow the universe to see your sites.
For Apache 2.4.x use this syntax:
<VirtualHost *:80>
ServerName blog.local
DocumentRoot "C:/wamp/www/blog/public"
Options Indexes FollowSymLinks
SetEnv APPLICATION_ENV "development"
<Directory "C:/wamp/www/blog/public">
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
Note NameVirtualHost *:80 no longer required for Apache 2.4.x
Again you would be better avoiding the Require all granted and using Require local until you actually want to allow the universe to see your sites.
EDITED After comment from Questioner:
Right, that's the Apache default. If you enter a url it cannot find a Virtual Host definition for it will default to the first Virtual Host definition you gave it, the blog in your case.
Ok, so now you need to create a Virtual Host for each of your other projects, and MOST IMPORTANTLY the first one needs to be localhost and only be allowed to be accessed from the local PC for a bit of extra security.
Now personally I would take this opportunity to move my actual sites to a totally separate folder structure outside the \wamp\ folder structure so there is no confusion with rights given to the \wamp\www folder and my other sites.
So for example, create a folder c:\websites\www and in that folder create a folder for each of your projects eg
c:\websites\www\blog
c:\websites\www\project2
Then point your virtual hosts to the relevant folder containing the site code ( this can be on another disk if you like ). This allows you to specify the Apache security ( who is allowed in to this site) specifically for each of your VHOSTS. So when you want a client or friend to be able to play with one site, you just change the security on that one site while you let them play.
Like this:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www">
AllowOverride All
# make sure this is only allowed to be accessed by the local machine
# then if/when you open one of your other sites up to the internet and somebody uses your IP
# they will get directed here as its the first VH def and then receive a 403 not allowed to access
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName blog.local
DocumentRoot "C:/websites/www/blog/public"
Options Indexes FollowSymLinks
SetEnv APPLICATION_ENV "development"
<Directory "C:/websites/www/blog/public">
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName project2.dev
DocumentRoot "C:/websites/www/project2"
Options Indexes FollowSymLinks
<Directory "C:/websites/www/project2">
DirectoryIndex index.php
AllowOverride All
Require local
# this site also available to other PC's on my internal network
Require ip 192.168.0
</Directory>
</VirtualHost>
Remember, for each new Virtual Host site you create you also need to add that ServerName (project2.dev) to the hosts file.
hosts file:
127.0.0.1 blog.local
127.0.0.1 project2.dev
I hope this helps.