Laravel valet not working - laravel

I use OSX El Capitan and PHP 7. I followed the installation guide so I install Laravel Valet version v1.1.3 successfully. I ping foo.dev or any.dev then the terminal prints
"64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.116 ms"
Everything is ok. My directory /User/mickey/Sites is added to Valet's paths. I created a Laravel 5.2 project named blog, then run the project with php artisan serve ok but when i accessed url blog.dev on the browser, the browser said
This site can’t be reached, blog.dev refused to connect. ERR_CONNECTION_REFUSED.
I don't know what is the problem with my installation. Thanks in advance!

You needn't run php artisan serve as Valet runs Caddy in the background.
Here're a few troubleshooting points.
Ensure that you don't have Apache (or anything else running on port 80)
sudo apachectl stop
Ensure that Valet is running
valet start
Ensure that PHP was installed with FPM
brew uninstall homebrew/php/php70
brew install homebrew/php/php70 --with-fpm

After trying everything I found on the internet (including this one which worth to try) for me the solution was to change valet's domain to test.
valet domain test
So I have no idea if the mentioned reinstall was needed or not but I know that I could ping or even curl my .dev sites but could not open them in any browser (Chrome nor Safari). Then I tried to set domain to .app but that did not work either. In the browsers I was redirected all the time to https even after running valet unsecure.
But then changed domain to .test and suddenly it started to work. I'm not sure what is the real issue here and why is this but I'm okay with it since it works again.
I've also read that .dev is not good any more because it's an official TLD and so reserved. (wikipedia)

I had nearly the same issue of Laravel Valet not working after installing via Homebrew on macOS 10.13 "High Sierra".
The problem I encountered was that DNSMasq would respond to queries, but Nginx would not handle the responses on port 80.
Attempting to connect to the site in a Terminal session would result in the following error:
$ curl -IL http://example.test/
curl: (7) Failed to connect to example.test port 80: Connection refused
I had recently upgraded from macOS 10.2 "Sierra" to 10.13 "High Sierra", so I suspected my Homebrew environment and configuration that was brought by the Migration Assistant could be at fault.
While following the troubleshooting advice here and elsewhere, what eventually solved my problem was to completely uninstall and remove Valet along with its dependencies (PHP, Nginx, DNSMasq, etc):
$ rm -rf ~/.valet
$ brew unlink nginx && brew remove nginx
$ brew unlink php56 && brew remove php56 && brew uninstall --ignore-dependencies php56
$ brew unlink php72 && brew remove php72
$ brew unlink dnsmasq && brew remove dnsmasq
With a clean slate, I was able to successfully install Valet:
$ brew update
$ brew install homebrew/core/php
$ composer global require laravel/valet
$ valet install
I then setup a new development domain:
$ valet domain test
$ valet park ~/Sites
$ mkdir ~/Sites/example && cd "$_"
$ valet link
$ echo "Hello, world" > ~/Sites/example/index.html
With Valet installed, I verified everything was working:
$ valet --version
$ sudo nginx -t
$ ping -c 4 example.test
$ curl -IL http://example.test/
$ valet open example
After doing all of this, I had a 100% successful working Laravel Valet environment.

Hopefully I can now solve this one for you. The Self Control fix worked as a temp fix for me so you may be in luck as I've found a permanent solution for me!
I once had a httpd setup which I followed a guide to install. This came with some baggage as the guide got you to forward 127.0.0.1 port 80 to port 8080.
Try this anyway Go > Go to folder...
/Library/LaunchDaemons/
The file in my case was called co.echo.httpdfwd.plist which I just needed to delete and then restart my Mac. See my question for more info Laravel Valet not working. 127.0.0.1 Connection Refused.
Let me know how you get on!

in my case, I encountered this after putting my mac to sleep but fixed it by running:
valet stop
and then
valet start

The problem was solved by starting self-control app. I don't know the reason but you can try to download and start this app to resolve this problem.

Related

Laravel valet secure does not work and where is nginx information coming from after deletion?

So I am working on Laravel/Valet, I was trying to use ssl. So I ran:
valet secure examplesite
This did not work. I have uninstalled valet, cleared cache, remove laravel/valet. Nothing worked. I just could not open the https://examplesite.test site. However, the non-secure http site is working fine.
Question 1: How can I get this to work? I am on MAC OS Sierra.
Question 2: Even after removing nginx and valet, I am still seeing something like the image shown when I load the page. Where is the information about the server nginx coming from?
Thank you very much.
So after running valet secure in the same directory of the web project;
I ran the code below:
sudo nginx -s stop && sudo nginx
Run
cd examplesite
valet secure
Without arguments inside the directory of your website
As for the error page you see there, it's hardcoded in the Nginx ngx_http_special_response
static char ngx_http_error_502_page[] =
"<html>" CRLF
"<head><title>502 Bad Gateway</title></head>" CRLF
"<body>" CRLF
"<center><h1>502 Bad Gateway</h1></center>" CRLF
;
For Windows 10 users:
Step 1:
Open cmd in administrator (sudo equivalent of linux)
Step 2:
valet stop if valet is already running
Step 3:
cd into your project directory (this is the most important step)
Step 4:
valet secure
Step 5:
valet start

Why doesn't homebrew apache start at startup?

I’m trying to figure out why my apache doesn’t start at startup… (I would like for it to).
My OS: OSX Mojave
Impressions I’m under: that I’m running homebrew’s apache
Upon a fresh boot…
If I hit http://localhost in a browser I get
Unable to connect
Firefox can’t establish a connection to the server at localhost.
Fire up terminal…
$brew services list
returns
httpd started bigpimpin /Users/bigpimpin/Library/LaunchAgents/homebrew.mxcl.httpd.plist
php started bigpimpin /Users/bigpimpin/Library/LaunchAgents/homebrew.mxcl.php.plist
(That first line makes me think httpd is running and I should be able to hit localhost).
$which -a apachectl
returns
/usr/local/bin/apachectl
/usr/sbin/apachectl
then
$apachectl configtest
returns
Syntax OK
then
$sudo apachectl -V
returns (among other things)
-D SERVER_CONFIG_FILE="/usr/local/etc/httpd/httpd.conf"
(Isn’t this brew’s httpd.conf?)
There's a brew command (which I forget) that I already ran that is supposed to run httpd at startup.
Once I run
$sudo apachectl start
everything is jake. So it’s a low-priority question, but one I would like to solve and understand.
I had the same issue with Homebrew NGINX.
Running the brew services command with sudo solved the problem for me.
It appears that the Homebrew web-server packages require sudo to start | stop | restart.
Try running:
sudo brew services start apache2

Ubuntu 16 upgrade results incredibly slow wifi

I recently upgraded to Ubuntu16 from 14. Everything went fine, however my wifi connection went to a crawl. I actually experienced this on a previous system that I installed Ubuntu16 on and because of that, stuck with Ubuntu14 for as long as I could until version lag forced me to upgrade.
I came across this solution that was referring to Ubuntu 17
https://askubuntu.com/questions/905288/extremely-slow-connection-after-17-04-update
And it seemed to do the trick!
The only issue is that now after a system suspend or boot-up, I have to run
sudo systemctl restart systemd-resolved
Otherwise I cannot connect to any server.
Its not a huge deal, I've aliased it at this point, but it would be nice get it operating appropriately.
Thanks for the help!
Download this link. If the download by the first link failed, download this file.
Open the Terminal and run these commands on your ubuntu pc.
cd rtlwifi_new-master
make
sudo make install
sudo modprobe -rv rtl8723be
sudo modprobe -v rtl8723be ant_sel=2
sudo ip link set wlp13s0 up
sudo iw dev wlp13s0 scan

Can't change document root for apache 2.4

I want to set up local web server using Apache and PHP on my Mac running Sierra. I followed this tutorial:
https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
And I am stuck at changing the document root from httpd.config, for whatever reason this change does not take effect at all. If I type http://localhost it still says "It works", it still uses the original html file.
Another weird thing is that apparently I can't stop apache at all. I tried running
$ sudo apachectl stop
but I still can’t access http://localhost
if I run
$ brew services list
httpd24 is stopped. What gives? What am I doing wrong?
There is an instance of apache pre-installed with macOS. So you have now two versions of apache installed. If you check:
which apachectl
you will probably obtain:
/usr/sbin/apachectl
which is the official macOS version of apachectl. Stop it with:
sudo apachectl stop
Disable the auto-loading of the pre-installed apache with (as explained in the tutorial you mentioned):
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
To run the homebrew version do:
brew services run httpd24
to stop it:
brew services stop httpd24
to register it to launch at login:
brew services start httpd24

Homebrew installation on Mac OS X Failed to connect to raw.githubusercontent.com port 443

When I try to install Homebrew, I am getting following connection refused error. Please help me to solve this problem.
$ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
Works for me. Unless its a real problem with github, which it may be but I'm going to guess that its not, its probably a problem with your connection.
Can you get to the same URL via a browser?
https://raw.githubusercontent.com/Homebrew/install/master/install
If you get an error there too, you know what your problem is. (Talk to your network admin)
If that works...maybe try doing just the "curl" command in your terminal to see if curl gives a more specific error?
Also, if that does work, save that file to a file on your computer (brew_install.rb) and then run it via
ruby brew_install.rb
If you are behind a proxy, try this:
sudo vim /etc/hosts
#add the line below and :wq
199.232.28.133 raw.githubusercontent.com
The accepted Answer is outdated now. But based on the answer I solved the problem by:
open the home page of brew https://brew.sh/
copy the URL from the install cmd and open it on your browser https://raw.githubusercontent.com/Homebrew/install/master/install.sh
right-click and save it to your computer
open a terminal and run it with: /bin/bash path-to/install.sh
It was a company proxy problem for me and the solution as mentioned here worked for me.
export HTTPS_PROXY=https://<proxy.mycompany>:<port>
git config --global https.proxy $HTTPS_PROXY
git config --global --get https.proxy
I had the same error,
- Disabled VPN
tried again installing without VPN
It worked for me.
There are several situations here, you can do following things :
reinstall the xcode command line tool by removing the old tools ($ rm -rf /Library/Developer/CommandLineTools) and xcode-select --install
request web page
https://raw.githubusercontent.com/Homebrew/install/master/install
then save it's content to shell file then run it.
change your DNS server to 8.8.8.8 (This is worked for me : ] )
Finally you should run /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
First try to open the link in the browser if it doesn't open then changing the DNS is the answer.
For me changing the DNS to 8.8.8.8 worked for me.
DNS settings can be searched for in the system setting which can be launched through spotlight in Mac OS and then changed.
This solved the pertinent issue for me.
I've seen this a few times on other people's machines and it seems to be fixed after you install xcode, i.e. xcode-select --install
The method of using ruby is probably outdated, as shown below:
As a better alternative, please set your computer's DNS server to 8.8.8.8
These steps solved the problem:
xcode-select --install
restart the Mac
Execute this command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
and it should work.
Check is https proxy is set
env|grep -I proxy
Then if it is set, remove the env variable
unset HTTPS_PROXY
I solved this problem by the following steps:
removing the old tools ($ rm -rf /Library/Developer/CommandLineTools)
install xcode command line tools again ($ xcode-select --install).
Although saving the shell file locally and then running it can solve this problem, but you'll meet it again when you do something similar(e.g. install oh-my-zsh, vim-plug, etc.)
At last, I find the 3rd item of this answer(https://stackoverflow.com/a/61787208/5458745) works best for me, as it can also solve the problem I meet when installing other tools using curl. However instead of changing the DNS, I add 8.8.8.8 to my original DNS server list, which works fine for me.
Change your DNS server to 8.8.8.8 (This is worked for me)
I solved it.
You can visit https://github.com/Homebrew/install/blob/master/install.sh to get this install.sh by copy the whole contents.
Then paste it into install.sh and run sh install.sh.
A combination of what #blueskin mentioned first and then what #Ferenc Yim mentioned is what worked for me.
The script also requires sudo access (not necessarily run with a sudo prefix just need admin access)
sudo vim /etc/hosts
Once the vim code editor is open add the following line at end of the file
199.232.68.133 raw.githubusercontent.com

Resources