Automate your process of setting up a local Laravel development environment on Ubuntu using Apache2.
- Ubuntu: This script is designed for Ubuntu-based systems.
- Apache2: Apache web server must be installed.
sudo
Access: You'll needsudo
privileges to run this script.
-
Clone the repository and get into it:
git clone git@github.com:bijaydas/quick-laravel-setup.git qls cd qls
-
Make it Executable:
chmod +x quick-laravel-setup.sh
-
Run the Script:
./quick-laravel-setup.sh <app_name>
-
Once the script finishes, you can access your Laravel application in your browser by going to
http://your_app.test
- Adds to
/etc/hosts
:- Adds an entry to your
/etc/hosts
file, mapping your local domain to127.0.0.1
(your local machine).
- Adds an entry to your
- Creates Apache Virtual Host:
- Creates a new Apache configuration file in
/etc/apache2/sites-available/
for your application. - Configures the
ServerName
,DocumentRoot
, and directory permissions.
- Creates a new Apache configuration file in
- Enables the Site:
- Enables the new Apache site using
a2ensite
.
- Enables the new Apache site using
- Enables
mod_rewrite
:- Enables the
mod_rewrite
Apache module, which is essential for Laravel routing.
- Enables the
- Restarts Apache:
- Restarts the Apache2 service to apply the changes.
- Provides Feedback:
- Displays messages during the script's execution to inform you of its progress.
- Application Path: The script assumes your Laravel application is located in
/var/www/your-app/public
. If your application is in a different location, you'll need to modify theAPP_PATH
variable in the script. - Domain Name: Choose a local domain name that you'll use for development (e.g.,
your-app.local
,your-app.test
). - Error Handling: The script includes basic error checking. If you encounter any issues, check the terminal output for error messages.
- Security: This script is designed for local development. Avoid running it on production servers.
- Manual Steps: If this script does not work, you can always manually perform the steps that it automates.