Laravel Apache

From AWVVO
Revision as of 06:39, 7 April 2025 by Admin (talk | contribs) (Install Apache2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Install Apache2

sudo apt install apache2
sudo systemctl start apache2
sudo systemctl enable apache2 
sudo systemctl status apache2

Create apache2 config fie for laravel app

sudo nano /etc/apache2/sites-available/myapp.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName your-domain.com  # Replace with your domain name or IP address
    DocumentRoot /var/www/html/myapp/public

    <Directory /var/www/html/myapp/public>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

sudo a2dissite 000-default.conf
sudo a2ensite myapp.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

sudo chown -R www-data:www-data /var/www/html/myapp/storage /var/www/html/myapp/bootstrap/cache
sudo chmod -R 775 /var/www/html/myapp/storage /var/www/html/myapp/bootstrap/cache