Serving sites
Once Valet Linux+ is installed, you're ready to start serving sites. Valet Linux+ provides a command to help you serve your sites: valet park
. Which will register the current working directory as projects root. Generally this directory is ~/sites
.
Create a sites
directory and park valet over there, so you can access all of your project from parked directory:
mkdir ~/sitescd ~/sites && valet park
That's all there is to it. Now, any project you create within your "parked" directory will automatically be served using the http://folder-name.test
convention.
For example:
-
mkdir ~/sites/example
-
cd ~/sites/example
-
echo "<?php echo 'Valet Linux+ at your service';" > index.php
- Go to
http://example.test
, you should seeValet Linux+ at your service
Domain Alias / Symlinks
Display all of the registered symbolic links based on the current folder.:
valet links
Add new alias:
valet link <domain>
For example:
valet link yourproject2
Will create a symbolic link to the current folder yourproject2.test
.
Remove alias:
valet unlink <domain>
For example:
valet unlink yourproject2
Securing Sites With TLS
By default, Valet serves sites over plain HTTP. However, if you would like to serve a site over encrypted TLS using HTTP/2, use the secure command. For example, if your site is being served by Valet on the example.test domain, you should run the following command to secure it:
valet secure example
To "unsecure" a site and revert back to serving its traffic over plain HTTP, use the unsecure
command. Like the secure
command, this command accepts the host name you wish to unsecure:
valet unsecure example
Proxy
Proxy supports to preview local ports on a secured subdomain with single line of command.
valet proxy domain host
Example:
valet proxy test http://localhost:3000
You can also list, unlink proxies with below commands:
List
valet proxies
Unlink/Remove Proxy
valet unproxy domain