Ubuntu 17.10部署Laravel时Homestead.test显示No input file specified求助
Hey there, let's tackle that "No input file specified" error you're seeing when trying to access Homestead.test. I've dealt with this exact issue a few times, so let's walk through the most likely fixes step by step:
1. Double-check your Homestead.yaml site mapping
Even though you said you didn't modify the file, it's worth confirming the path to your Laravel project's public folder is correct. Open your Homestead.yaml file (usually in ~/Homestead/) and look for the sites section:
sites: - map: homestead.test to: /home/vagrant/code/public
Make sure your local Laravel project is stored in ~/code (so the public folder is at ~/code/public). If your project is in a different directory (like ~/projects/my-laravel-site), update the to value to /home/vagrant/projects/my-laravel-site/public, then run:
vagrant reload --provision
2. Verify the Nginx site configuration in the VM
Sometimes the auto-generated Nginx config has mismatched paths. SSH into your Homestead box first:
vagrant ssh
Then check the site config file:
sudo nano /etc/nginx/sites-available/homestead.test
Ensure the root directive points to the correct public folder inside the VM, like:
root /home/vagrant/code/public;
If you make changes, save the file (Ctrl+O, then Enter) and restart Nginx:
sudo service nginx restart
3. Stop XAMPP's Apache service
You mentioned running XAMPP—Apache uses port 80, which Homestead relies on by default. If Apache is using port 80, Homestead can't serve your site properly. Open the XAMPP control panel, stop the Apache service, then restart Homestead:
vagrant reload
4. Confirm your project files are synced to the VM
It's possible your local project files aren't being synced to the Homestead VM. SSH into the VM and check the mapped directory:
vagrant ssh cd /home/vagrant/code ls -la
If you don't see your Laravel project files here, double-check the folders section in Homestead.yaml:
folders: - map: ~/code to: /home/vagrant/code
Ensure your local ~/code folder contains your Laravel project, then re-provision to sync the folders:
vagrant reload --provision
5. Clear Laravel's cache (if your project exists in the VM)
If your files are present but you still get the error, cached configuration paths might be causing issues. From within your project directory in the VM:
php artisan cache:clear php artisan config:clear
6. Check your Ubuntu hosts file
Make sure your local hosts file maps Homestead.test to Homestead's IP address. Open the hosts file with:
sudo nano /etc/hosts
Look for a line like this—add it if it's missing:
192.168.10.10 homestead.test
Save the file and try accessing the site again.
内容的提问来源于stack exchange,提问作者Khrisna Gunanasurya

