How to run laravel 5 on port 80 of localhost?
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
How to Run Laravel 5 on Port 80 of Localhost: Moving Beyond php artisan serve
As developers, we often encounter a disconnect between the ease of local development and the realities of production deployment. You’ve observed correctly: while php artisan serve is fantastic for quick testing—launching an application on localhost:8000—it is fundamentally unsuitable for anything beyond a casual demonstration. When you need to run Laravel 5 on port 80, you aren't just asking PHP to execute a file; you are asking a proper web server (like Apache or Nginx) to handle routing and serving static assets, which requires a different approach.
This post will walk you through the correct, professional method for deploying a Laravel application directly on port 80 of your local machine, bypassing the limitations of the development server.
The Difference Between Development and Production Serving
The reason php artisan serve works so easily is that it spins up a minimal PHP development server specifically designed to handle routing within the framework context. It’s excellent for iterating quickly. However, this server operates purely within the PHP execution environment, which doesn't replicate how a real web server handles requests, security headers, or proper directory mapping required for production environments.
When you aim to run Laravel on port 80, you are essentially setting up a standard web hosting scenario. This means your request must be handled by a robust HTTP server that points directly to the application's public entry point.
The Solution: Configuring Your Web Server (Apache/Virtual Host)
To serve a Laravel application correctly on port 80, you need to configure your local web server (assuming you are using XAMPP, WAMP, or a similar stack) to treat the Laravel public directory as the document root for that specific URL.
Here is the conceptual approach:
- Ensure Dependencies: Make sure you have a working PHP environment and Apache installed on your local machine.
- Locate the Public Folder: Navigate to your Laravel installation folder and identify the
/publicdirectory. This directory contains all the web-accessible files (entry points, CSS, assets). - Configure Virtual Host: You must create or modify a Virtual Host configuration file within your Apache setup (
httpd.confor an included configuration file) to maphttp://localhost/directly to that/publicdirectory.
Step-by-Step Implementation Example (Conceptual)
For a typical XAMPP setup, this involves editing the Apache configuration files:
1. Locate the Configuration File:
Find your main Apache configuration file (often located in xampp\apache\conf\httpd.conf).
2. Create or Modify the Virtual Host:
You need to define a virtual host that listens on port 80 and directs traffic to the Laravel public folder.
# Example Virtual Host Configuration for Laravel on Port 80
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:/xampp/htdocs/your_laravel_project/public" # Adjust this path!
ErrorLog "logs/error.log"
CustomLog "access.log" combined
</VirtualHost>
3. Restart the Server:
Save the changes and restart your Apache service for them to take effect.
By setting the DocumentRoot to point directly at the /public directory, you instruct Apache to serve files from that location when a request comes in for http://localhost/. This is the standard practice for deploying modern PHP frameworks, ensuring security and proper routing, much like the standards promoted by organizations like Laravel Company.
Conclusion: Best Practices Over Shortcuts
While the simplicity of php artisan serve is appealing for quick testing, relying on it for anything resembling a production environment is a technical shortcut that sacrifices real-world architectural understanding. As senior developers, our goal is to understand how the application interacts with the infrastructure.
For running Laravel 5 (or any modern framework) on port 80, the correct path is always through configuring a proper web server setup. This practice ensures your application is secure, scalable, and adheres to industry standards. Always favor robust server configurations over quick command-line hacks when deploying or testing larger applications.