Skip to content

Instantly share code, notes, and snippets.

@valeryan
Last active May 4, 2021 09:25
Show Gist options
  • Star 32 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save valeryan/d071dad5a32ccf94d07e685a2bdd2818 to your computer and use it in GitHub Desktop.
Save valeryan/d071dad5a32ccf94d07e685a2bdd2818 to your computer and use it in GitHub Desktop.
Local WSL Setup

Deprecated in favor of Valet Wiki Page

I set up the wiki page for the valet-wsl project and moved the install guide there. This way it can have user contributions. Please have all disscussions or issues under the valet-wsl project so I can be aware of it. Please go to Valet Wsl Installation Guide

@ItsWendell
Copy link

ItsWendell commented Oct 21, 2017

Bash for Windows is great, this is the one thing I was missing when devleoping on windows instead of linux.

It's technically possible to run windows executable's and scripts from WLS right? Isn't it possible to trigger install_certs.cmd after everytime we run Valet Secure?

I'm still doubting to use Valet for Linux on WLS because of it issues, do you have any other tips as an alternative to this?

@valeryan
Copy link
Author

valeryan commented Nov 9, 2017

The install cert script requires a UAC prompt. I have not figured out a way to get that to work if called from wsl. But it is possible to call the script from wsl it just doesn't manage to propagate the UAC prompt out to the windows box. I think it should be possible but like most I am just fumbling around in the dark with a flickering flash light. Sometimes I find something that works and sometimes its all a big failure.

@maxi032
Copy link

maxi032 commented May 1, 2018

I have my projects inside /mnt/c/users/max/MyUbuntuApps and the owner of MyUbuntuApps is root. Is this ok? Shouldn't the ubuntu user be the owner ?

@valeryan
Copy link
Author

@maxi032 part of how windows and wsl manages permissions causes anything under /mnt/c to be owned by root. There is an article on the WSL help site that explains how permissions are handled on the shared windows content. I don't remember where it is right now but its normal for root the be the owner.

@codepuncher
Copy link

Thanks for this! Also cool to find out about Terminus! Pretty decent terminal emulator.

@fbhood
Copy link

fbhood commented Oct 16, 2018

Thanks for sharing this doc @valeryan! It's worked like a charm for me using WSL / Ubuntu 18.04. The only problem was with the composer path that in my case is in /.config/composer/vendor/bin
instead of ~/.composer/vendor/bin

Would be great to trigger the cert script with valet secure but it's great also as it is!!
Thanks again!

@PolCPP
Copy link

PolCPP commented Nov 12, 2018

Thanks again for the doc, by the way, had some performance problems, but fixed them using
adding fastcgi_buffering off; to nginx

On the matter of running install_certs after valet secure. Haven't tried but maybe using this "win-sudo" could make the trick https://github.com/imachug/win-sudo/blob/master/s/sudo

@fbhood
Copy link

fbhood commented Nov 14, 2018

Hey @valeryan, I was wondering why valet gets stuck when loading a website in the browser while php artisan serve deliver it immediately. It seems not refreshing the pages and just keeps loading it until you hit refresh a couple of time then it display the page. Did you experience a similar issue?

@valeryan
Copy link
Author

You know I don't seem to get @ messages from gist. I will have to see if there is a setting for that. I have not been using windows for a bit but I just moved over to a windows machine at work again. I will probably have some time to test this setup again soon. I have been meaning to get back around to this setup for a while. I believe that DnsMasq now works with WSL so I will be able to remove the need for Acrylic and restore the default DNS setup in WSL-Valet. I still don't know if there is a way to run the SSL script from within WSL because of the required UAC Prompt. If UAC is disabled it would work. I have run the script from WSL before but it just swallows the UAC prompt.

@rginnow
Copy link

rginnow commented Nov 28, 2018

Thanks again for the doc, by the way, had some performance problems, but fixed them using
adding fastcgi_buffering off; to nginx

On the matter of running install_certs after valet secure. Haven't tried but maybe using this "win-sudo" could make the trick https://github.com/imachug/win-sudo/blob/master/s/sudo

I spent 12 hours today banging my head on a wall while my site was half loading, and then stalling for 60 seconds before loading the images, or running an AJAX request.

I added fastcgi_buffering off; and fastcgi_keep_conn on; to my nginx config and it fixed it first try. This just saved my a$$.

@rana01645
Copy link

How to make valet loading fast in wsl:
open nginx config file in any editor (located in /etc/nginx/nginx.conf)

Add this line
fastcgi_buffering off;
and save the file

Then restart nginx by running this command
sudo service nginx restart

Now every site will run fast :D

@surahmans
Copy link

surahmans commented Feb 3, 2019

Please help. I can't figure it out why this happens.

This site can’t be reached mysite.dev refused to connect.

But when I browse to 127.0.0.1 I can see "404 - Not found" by valet

@maherelgamil
Copy link

@surahmans

Please help. I can't figure it out why this happens.

This site can’t be reached mysite.dev refused to connect.

But when I browse to 127.0.0.1 I can see "404 - Not found" by valet

follow this configuration on win 10 :
http://mayakron.altervista.org/wikibase/show.php?id=AcrylicWindows10Configuration

@jamieburchell
Copy link

jamieburchell commented Feb 9, 2019

I'm looking to install the LaravelValetSelfSigned.pem root CA so that SSL sites work without warnings, however I can't find this file? laravel/valet#515

Edit: @valeryan It looks like a lot of improvements have been made upstream such as using a root CA that can be installed on devices, and allowing secure sharing through ngrok.

If the new Valet setup uses its own or a custom root CA then I think there is no longer a need to have the windows scripts that install each site certificate as only the root CA would need to be installed as a one time setup.

Is there any plan to merge in those changes or would that be too complicated given the changes that need to be made to support WSL?

@apurbajnu
Copy link

Please fix this line export PATH=/.composer/vendor/bin:$PATH it will be export PATH=/.config/composer/vendor/bin:$PATH

@namelus
Copy link

namelus commented Mar 17, 2019

I am having some issues at the MySQL config step.

namelus@DESKTOP-2ORV3KU:/etc/mysql$ sudo mysqladmin -u root -h localhost password <myPassWord>
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

Any suggestions?

@namelus
Copy link

namelus commented Mar 19, 2019

@surahmans

Please help. I can't figure it out why this happens.
This site can’t be reached mysite.dev refused to connect.
But when I browse to 127.0.0.1 I can see "404 - Not found" by valet

follow this configuration on win 10 :
http://mayakron.altervista.org/wikibase/show.php?id=AcrylicWindows10Configuration

Did this work? I am still encountering the 404.

@valeryan
Copy link
Author

valeryan commented May 1, 2019

I set up the wiki page on this project and moved the install guide there. This way it can have user contributions. https://github.com/valeryan/valet-wsl/wiki/Installation-Guide

@khessels
Copy link

In order to have correct permissions i would add the following commands
sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata

source:
https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment