thedevdojo / larasail

LaraSail - Set Sail with your Laravel app on DigitalOcean
https://devdojo.com/devdojo/larasail-laravel-on-digital-ocean
587 stars 103 forks source link

Feature: Add support for Apache #89

Open domaingood opened 2 years ago

domaingood commented 2 years ago

https://marketplace.digitalocean.com/apps/laravel Please add Apache+ OpenLiteSpeed phpMyAdmin Redis Upgrade PHP 8.1

bobbyiliev commented 2 years ago

Hi there @domaingood,

What is the main benefit of switching from Nginx to Apache?

Regarding phpMyAdmin, I would prefer to keep the 1-Click installation clean for such additional resources as you can easily install them if you need them:

wget https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-languages.zip
unzip phpMyAdmin-5.0.2-all-languages.zip
mv phpMyAdmin-5.0.2-all-languages /var/www/public/phpmyadmin
SamuelMwangiW commented 2 years ago

In addition to Bobby's comment, you can use Larasail to set up PHP8.1 and Redis.

larasail setup php81 redis

Hi there @domaingood,

What is the main benefit of switching from Nginx to Apache?

Regarding phpMyAdmin, I would prefer to keep the 1-Click installation clean for such additional resources as you can easily install them if you need them:

wget https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-languages.zip
unzip phpMyAdmin-5.0.2-all-languages.zip
mv phpMyAdmin-5.0.2-all-languages /var/www/public/phpmyadmin
domaingood commented 2 years ago

We dont know how to config Nginx.Other hand Apache easy to use.You can use [openlitespeed] if need more benefit.

Hi there @domaingood,

What is the main benefit of switching from Nginx to Apache?

Regarding phpMyAdmin, I would prefer to keep the 1-Click installation clean for such additional resources as you can easily install them if you need them:

wget https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-languages.zip
unzip phpMyAdmin-5.0.2-all-languages.zip
mv phpMyAdmin-5.0.2-all-languages /var/www/public/phpmyadmin
bobbyiliev commented 2 years ago

To be honest, I personally have never used OpenLitespeed together with Laravel.

Nginx is actually easier to configure than Apache, all you need is PHP-FPM and the following server block:

server {
        root $rootPath/public;
        index index.php index.html index.htm;
        server_name $serverName;
        location / {
                try_files \$uri \$uri/ /index.php?\$query_string;
        }
        location ~*  \.(jpg|jpeg|png|gif)\$1 {
                expires 365d;
        }
        location ~*  \.(ico|css|js)\$ {
                expires 365d;
        }
        location ~ \.php\$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php$phpVersion-fpm.sock;
        }
        location ~ /\.ht {
                deny all;
        }
}

And even with the LaraSail script, you don't really need to do any config changes.

I am not sure if we will ever add Apache rather than Nginx for LaraSail as the majority of people would default to Nginx anyway. If you still prefer Apache, you can always install a LAMP server with 1-Click via this link here:

https://marketplace.digitalocean.com/apps/lamp

And then deploy Laravel there.

Of course, we are open to suggestions, if we see enough demand for Apache, we could look into this. Also feel free to submit a PR if you wish.

domaingood commented 2 years ago

After freash install from https://marketplace.digitalocean.com/apps/laravel then larasail setup php81 redis is currently unable to handle this request. HTTP ERROR 500

In addition to Bobby's comment, you can use Larasail to set up PHP8.1 and Redis.

larasail setup php81 redis

Hi there @domaingood, What is the main benefit of switching from Nginx to Apache? Regarding phpMyAdmin, I would prefer to keep the 1-Click installation clean for such additional resources as you can easily install them if you need them:

wget https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-languages.zip
unzip phpMyAdmin-5.0.2-all-languages.zip
mv phpMyAdmin-5.0.2-all-languages /var/www/public/phpmyadmin
bobbyiliev commented 2 years ago

Note: Do not use the larasail setup command with the 1-click Laravel installation!

If you want Redis just run sudo apt -y install redis-server.

Also note that the LaraSail script and the 1-Click installation are two separate things. If you have any feedback for the 1-Click image refer to this repo here:

https://github.com/bobbyiliev/laravel-digitalocean-1-click

Let me know if you have any questions.