You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel项目启动问题求助:新手无法启动Blog项目

How to Launch Your Laravel Blog Project on XAMPP (Windows 10)

Hey there! I totally get the confusion when you're just starting out with Laravel—let's get your blog project up and running without any fuss. Here are the two easiest methods tailored to your XAMPP setup:

This is the simplest way because it bypasses any Apache configuration headaches:

  • Open Command Prompt (CMD) on your Windows 10 machine.
  • Navigate to your blog project's root directory using the cd command. For example, if your project is in C:\xampp\htdocs\blog, run:
    cd C:\xampp\htdocs\blog
    
  • Once you're in the project folder, start the server with:
    php artisan serve
    
  • You'll see a message like Laravel development server started: http://127.0.0.1:8000 in the terminal. Just copy that URL into your browser, and your blog should load right up!

Method 2: Configure XAMPP Apache to Access via localhost or a Custom Domain

If you prefer using XAMPP's Apache server directly, here's what you need to fix the localhost/blog issue:

Quick Fix (Temporary)

Laravel's entry point is always the public folder—so instead of localhost/blog, try visiting:

localhost/blog/public

This should work, but the URL will have /public in it, which isn't ideal long-term.

Permanent Fix: Set Up a Virtual Host (Cleaner URL)

This lets you use a custom domain like blog.test instead of messy paths:

  1. Open the XAMPP Apache virtual hosts file: C:\xampp\apache\conf\extra\httpd-vhosts.conf
  2. Add these lines at the end of the file (replace the path with your actual project's public folder location):
    <VirtualHost *:80>
        DocumentRoot "C:\xampp\htdocs\blog\public"
        ServerName blog.test
    </VirtualHost>
    
  3. Edit your Windows hosts file (requires admin rights):
    • Go to C:\Windows\System32\drivers\etc\hosts
    • Add this line at the bottom:
      127.0.0.1 blog.test
      
  4. Restart the Apache server from the XAMPP control panel.
  5. Now you can just type blog.test in your browser to access your Laravel blog!

Quick Troubleshooting Check

If you run into issues with php artisan serve, make sure you've installed all the project dependencies. If there's no vendor folder in your project, run this in the project root:

composer install

内容的提问来源于stack exchange,提问作者giggiox

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 06:59:24