I'm basically trying to run my Laravel installation over laravel valet through Local Network sharing. I've followed the steps described on: https://laravel.com/docs/9.x/valet#sharing-sites-on-your-local-network
However, I'm still having a 404 - not found when trying to access my website over "192.168.31.166/my-app.test".
I tried both with and without HTTPS Certificate and still got the same error. I can access the website from: my-app.test but not from 127.0.0.1/my-app.test nor from 192.168.31.166/my-app.test
Here is my valet.config file (I deliberately changed my username to USERNAME as it includes my real name):
server {
listen 80 default_server;
#listen VALET_LOOPBACK:80; # valet loopback
root /;
charset utf-8;
client_max_body_size 128M;
location /41c270e4-5535-4daa-b23e-c269744c2f45/ {
internal;
alias /;
try_files $uri $uri/;
}
location / {
rewrite ^ "/Users/USERNAME/.composer/vendor/laravel/valet/server.php" last;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log "/Users/USERNAME/.config/valet/Log/nginx-error.log";
error_page 404 "/Users/USERNAME/.composer/vendor/laravel/valet/server.php";
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass "unix:/Users/USERNAME/.config/valet/valet.sock";
fastcgi_index "/Users/USERNAME/.composer/vendor/laravel/valet/server.php";
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME "/Users/USERNAME/.composer/vendor/laravel/valet/server.php";
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~ /\.ht {
deny all;
}
}
You need to add domain and your server IP to
/etc/hosts
firstand then you can access from another device with my-app.test domain.