一直試圖使用Laravel代客運行的臨時網址https://xxxxx.ngrok.io共享本地網站。當我運行代客版本1.1.22時:Laravel代客共享URL導致連接被拒絕
valet --version
Laravel Valet version 1.1.22
安全的ngrok url導致連接被拒絕。當它不安全時,它也會導致連接被拒絕(404僅在輔助機器上運行,因爲它不會在那裏找到)。無論是那個還是DNS解決問題,我後面都會提到。
本地在我的無線網絡和個人電腦上工作得很好。訪問日誌顯示此:
127.0.0.1 - [03/Oct/2016:08:57:06 +0300] "POST /server.php?doing_wp_cron=1475474226.5450510978698730468750 HTTP/1.1" 200 0
127.0.0.1 - [03/Oct/2016:08:57:07 +0300] "POST /server.php HTTP/1.1" 200 47
127.0.0.1 - [03/Oct/2016:08:59:09 +0300] "POST /server.php?doing_wp_cron=1475474348.8563120365142822265625 HTTP/1.1" 200 0
127.0.0.1 - [03/Oct/2016:08:59:10 +0300] "POST /server.php HTTP/1.1" 200 47
還沒有看到相關的在〜/ .valet /日誌/ access.log的在此日誌中拒絕連接的錯誤。錯誤日誌顯示舊錯誤,與此問題無關。終端節目中的Ngrook窗口301在我剛剛嘗試的兩個負載上永久移動。 Ngrok狀況進行現場http://localhost:4040/status給我看:
GET/HTTP/1.1
Host: site.dev
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.8 (KHTML, like Gecko) Version/9.1.3 Safari/601.7.8
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-us
X-Forwarded-For: xx.xx.xx.xxx
X-Forwarded-Proto: https
X-Original-Host: xxxxxx.ngrok.io
,然後重定向:
HTTP/1.1 301 Moved Permanently
Content-Type: text/html; charset=UTF-8
Location: http://mysite.dev/
Server: Caddy
Status: 301 Moved Permanently
X-Powered-By: PHP/7.0.11
X-Ua-Compatible: IE=edge
Date: Mon, 03 Oct 2016 06:14:10 GMT
Content-Length: 0
Caddyfile這裏完成(通過代客生成):
import /Users/jasper/.valet/Caddy/*
:80 {
fastcgi/127.0.0.1:9000 php {
index server.php
}
rewrite {
to /server.php?{query}
}
log /Users/jasper/.valet/Log/access.log {
rotate {
size 10
age 3
keep 1
}
}
errors {
log /Users/jasper/.valet/Log/error.log {
size 10
age 3
keep 1
}
}
}
Ngrok運行過(後添加tld域更改爲.localhost):
ps aux | grep ngrok
jasper 1260 0.0 0.2 556735952 28692 s001 S+ 10:23AM 1:27.14 /Users/jasper/.composer/vendor/laravel/valet/bin/ngrok http -host-header=rewrite site.localhost:80
root 1254 0.0 0.1 2463108 8964 s001 S+ 10:23AM 0:00.01 sudo -u jasper /Users/jasper/.composer/vendor/laravel/valet/bin/ngrok http -host-header=rewrite site.localhost:80
jasper 3557 0.0 0.0 2432804 2096 s000 S+ 2:36PM 0:00.00 grep ngrok
所以它確實打到了Caddy服務器,並且ngrok狀態確實表明了這一點。但它然後做了重定向,這意味着連接被拒絕或瀏覽器的DNS解析問題。那麼這裏有什麼問題?
按照http://stackoverflow.com/questions/37719851/pinging-test-dev-after-laravel-valet-install-returns-unknown-host#37730896的建議做了'valet domain localhost',並重新啓動我擔心TLD名稱衝突。但是,不,這不是問題.. – rhand
另外Safari有時會告訴我現在沒有找到隧道www.xxxx.ngrok.io。 Chrome仍然顯示拒絕連接。 – rhand
iOS Chrome中的最新錯誤是無法找到DNS地址。由於沒有Ngrok日誌條目出現,它現在甚至不會在本地點擊該網站。 – rhand