Install without nginx? Goal: magento 2.4 install

I am having trouble getting magento properly installed and i thought maybe apache2/nginx set up might be complicating things a lot.
i did a complete rebuild and selected ‘no’ for nginx (see below)

Defining help function
help() {
echo "Usage: $0 [OPTIONS]
-a, --apache Install Apache [yes|no] default: yes
-n, --nginx Install Nginx [yes|no] default: no
-w, --phpfpm Install PHP-FPM [yes|no] default: yes
-o, --multiphp Install Multi-PHP [yes|no] default: yes

but it seems like nginx is still installed?

is it not possible to install with just Apache webserver?
trying to make this the least complicated as possible, since so far no luck getting magento to install properly.

Anyone have any suggestions? please?

thanks

It should be still possible how ever:

  1. We will drop “Standalone” Apache2 support in 1.4. The time required to make those changes for debugging / new features do not outweight current usage by users.

  2. Apache2 is not optimised for static files. And might cause preformace issues.

I have installed Magento 2.4 in the past on a Nginx standalone server so it should be possible. I only had to slightly update template files

do you know if Magento Quick install feature will come back sometime? i just arrived to hestiacp recently, but i read that last year magento quick install was a preinstalled feature.

No, due to a lot of dependencies (memcache and other services) of magento 2, a quickinstall will probaly never come.

It was added as an placeholder but never working. During install it required at least 6 gig of ram and also Eleastic search / rabbitmq as an dependency. We didn’t see it as a fit for HestiaCP for “Clients” installing it.

2 Likes

We’re using Magento 2.4 with Hestia, PHP 7.4, ElasticSearch, MariaDB 10.5 and NGINX 1.19 only (forget using Apache) on Debian 10.

We installed Hestia: bash hst-install.sh -n yes -w yes -t no -c no -x no -z yes -b yes -i yes -m yes -l en \ -s server.domain.com -e [email protected] -p (password) -a no -k no -o no -v no -k no We don’t use our Hestia server for email so email wasn’t installed.

Install Magento 2.4.2 using as your domain user and choose the Magento template from the Hestia panel. Setup your typical Magento 2.4 optimizations and you’ll have your M2 store running in no time. Under 300ms page load time with the M2 FPC running in production mode is easily obtainable.

Wish we had left our old paid panel and CentOS years ago :slight_smile:

2 Likes

Thanks for the feedback themew. however, the magento template (quick install) is no longer an option. apparently gone for a while already. from what some of the admins are saying, 2.4.2 is hard to set up quick install package.

Hi @emeeder The Magento template I’m referring to is the template created by the HestiaCP team. Once you’ve installed M2.4 from the command line, from the panel’s user, direct your site to the /magento folder, activate php 7.4 and from the drop down, choose Magento as the software running in that directory. HestiaCP will force the /pub to load from static and setup the correct NGINX settings to optimize Magento. You’ll still have to manually make changes to the php.ini file and the admin settings in the backend of Magento, but the HestiaCP template does a nice job of making your life a little easier. Again, don’t install Apache so M2 runs on NGINX and PHP-FPM only. Also edit the Magento install file to allow M2.4 to install using MariaDB 10.5 and you’re set.

I guess you misunderstood. he did not mean the quick installer. as @eris already pointed out, there never was a quick install option for magento in the first place.

with template he means the settings you chose within the web domain pane. there it has a specific magento one - but only if on nginx only. hope this clears things up a bit.

see the other thread, that’s what I’d recommend as well. and this even works on a nginx+apache install with standard templates (settings), as you can then use .htaccess instead.

you just won’t be able to use the webinstaller, but there is no need anyway.

Thanks a lot for all that advice and help. Gives me something to work on this weekend since we are in lockdown again anyways…:frowning:
I was unaware of those settings within the web domain pane.

Mew- you guys not having any issues running with MariaDB 10.5? (with the edit to the di.xml file prior to install)
I had been editing my hst-install.sh file to install MariaDB 10.4 when i set up Hestiacp.
I wonder what would be the best option?

Thanks again for the help!

Nope so far no issues. Site’s been using 10.5 for about 5+ months.

While we are on this topic.
On magento.com requirement listings state:
RabbitMQ, Redis and Varnish as requirements.

When i read the tutorials online. only Elasticsearch is emphasized as a requirement and instructions are given about that.
Most tutorials seem to ignore RabbitMQ, Redis and Varnish.
Are these essential or are they optional requirements?

I used How to get the Magento software | Magento 2 Developer Documentation in the past

/home/$user/.composer/composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition /home/$user/web/$domain2/public_html/

/home/$user/web/$domain2/public_html/bin/magento setup:install --base-url=https://$domain/ \
--base-url-secure=https://$domain/ \
--db-host=localhost --db-name=$fdb_user --db-user=$fdb_user --db-password=$db_password \
--admin-firstname=$fname --admin-lastname=$lname --admin-email=$email \
--admin-user=$admin --admin-password=$password --language=$language \
--currency=$currency --timezone=$timezone --use-rewrites=1 \
--search-engine=elasticsearch7 --use-secure-admin=1 --use-secure=1 \
--cache-backend=redis --cache-backend-redis-server=127.0.0.1 --cache-backend-redis-db=$backend \
--page-cache=redis --page-cache-redis-server=127.0.0.1 --page-cache-redis-db=$redis

As install command

I for sure did not install rabbitmq nor varnish. redis I am not sure (but to lazy to look up right now :-P)

so I’d say they’re rather optional. if my memory serves me right only elasticsearch is a hard requirement. and I also changed mariadb to 10.4 on hestias installer, but would assume that running on 10.5 won’t implicate any real changes or issues.

Elastic search was an hard requirement. And that was the reason why we have decided to drop the installer for Magento as quick installer as it is not feasible on “shared” hosting servers…

2 Likes

I want to thank all of you guys above for helping me get this installed. Really appreciate it.

I finally managed to get Magento installed properly. I’m just going to share some issues I ran into and resolved before I finally got it to install properly. This is in no particular order. But all this needs to be done prior to actually running the install command (except #8).

1: the magento database password can not have any special characters. Just use numbers/letters/uppercase/lowercase. I kept getting SQLSTATE[HY000][1045] Access Denied error. Simplifying password resolved this.
2: edit your php.ini files in /etc/php/7.4/ prior to install memory 4G, zlib.output_compression=on, realpath_cache_size=10M, realpath_cache_ttl=7200 - I changed both the php.ini files in the /cli and the /fpm folders - not sure if both are necessary.
3: Edited di.xlm file to allow the 10.5 Maria DB. Search for 10.4 and change to 10.5 and in the same line change ‘2-4’ to ‘2-5’ (google for more details)
4: if your site is https// (secure) already, make sure you install with:
bin/magento setup:install
–base-url-secure=https://domain.com/
–db-host=localhost
5: don’t forget the ‘/’ after your domain
6: I didn’t run into any permission issues when I ran these lines in the public_html folder where my magento installation would be installed (I ran them with root user 1 line at a time):
sudo find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
sudo find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
sudo chown -R :www-data .
sudo chmod u+x bin/magento
7: make your magento user (where magento will be installed) within the hestiscp, not in Commandline. Also create the database in hestiacp. After doing so. Got to myPHPadmin using root user and give your new magento user/database ALL Privileges. (similar to the MariaDB database privileges).
8: if you get the 2Factor Authorization at the admin login - and you didn’t get an email. You can disable 2 factor auth using
$ php bin/magento module:disable Magento_TwoFactorAuth
9: read the posts above to get other advice that greatly helped me. Especially about using only NGINX when 1st installing my hestiacp panel. Then in the domain section of your user. Make sure to select ‘magento’ as your domain setup.
10: Elasticsearch (and java) is not hard to set up using many tutorials available. I think it gets a lot more complicated with multiple servers (?).
11: eris - I don’t think that install command is completely up to date. Refer to magento site for current instructions. I think everything after “–use-rewrites=1” is no longer required.

Hopefully this will help someone who is having issues like me.

2 Likes

I do have 1 other question about the Cron Job setup:

bin/magento cron:install

i dont see the cron job listed in the panel for magento user.
do i need to set them up in the panel instead of the command line?
will they function the same?

~$ crontab -l
results in:
#~ MAGENTO START
/usr/bin/php7.4 /home/magento/web/domain.com/public_html/bin/magento cron:run 2>&1 | grep -v “Ran jobs by schedule” >> /home/magento/web/domain.com/public_html/var/log/magento.cron.log
#~ MAGENTO END

but nothing in the panel cron section

Client got multiple installations running and if you Use Redis it required:

I have an “Installer” script running

#!/bin/bash

#Country / Lang settings
language="en_US"
currency="GBP"
timezone="Europe/London"
searchengine="elasticsearch7"

source /etc/profile.d/hestia.sh

# magent_keys.sh located in /root/ should contain the ssh files
# format (With out #)
# public='public_key_here';
# private='private_key_here';

if [ ! -e "~/keys.sh" ]; then
echo "~/keys.sh missing"
    exit;
fi
source ~/keys.sh
# Version / composer are optional
while [ "$1" != "" ]; do
    case $1 in
        -u | --user )           shift
                                user="$1"
                                ;;
        -d | --domain )		shift
                domain="$1"
                ;;
        -f | --fname )		shift
                fname="$1"
                ;;
         -l | --lname )		shift
                lname="$1"
                ;;       
        
        -a | --admin )		shift
                admin="$1"
                ;;
        -p | --password )		shift
                password="$1"
                ;;
        -e | --email )		shift
                email="$1"
                ;;
        -r | --redis )		shift
                redis="$1"
                ;;
        -b | --backend )		shift
                backend="$1"
                ;;
        -v | --version )     shift
                version="$1"
                ;;
        -c | --composer )    shift
                composer="$1"
                ;;						
    esac
    shift
done

###############

###############

# Check if user exists
if [ ! -e /usr/local/hestia/data/users/$user/user.conf ]; then
    echo "$user does not exits";
    exit;
fi

test=$(redis-cli INFO | grep ^db$redis:)
if [ ! -z "$test" ]; then
    echo "Redis Database $redis already exists"  
    exit;
fi

test=$(redis-cli INFO | grep ^db$backend:)
if [ ! -z  "$test" ]; then
    echo "Redis Database $backend already exists"  
    exit;
fi

# Create composer folders 
v-add-user-composer $user
rm /home/$user/.composer/composer
if [ -z $composer ]; then
    wget --tries=3 --timeout=15 --read-timeout=15 --waitretry=3 --no-dns-cache https://getcomposer.org/composer-2.phar --quiet -O /home/$user/.composer/composer
else
    wget --tries=3 --timeout=15 --read-timeout=15 --waitretry=3 --no-dns-cache https://getcomposer.org/composer-$composer.phar --quiet -O /home/$user/.composer/composer    
fi
chmod +x /home/$user/.composer/composer
chown $user:$user /home/$user/.composer/composer

v-change-user-shell $user 'bash'


web=$(grep -F -H "DOMAIN='$domain'" /usr/local/hestia/data/users/$user/web.conf);

if [  -z "$web" ]; then 
    #echo "Domain doesn't exits"
    domain2=${domain//www./}
    web=$(grep -F -H "DOMAIN='$domain2'" /usr/local/hestia/data/users/$user/web.conf);
    if [ -z "$web" ]; then
    echo "Domain doesn't exits"
    exit;
    fi
fi
 echo -e "{\n\t\"http-basic\":\n\t\t{\n\t\t\"repo.magento.com\": {\n\t\t\t\"username\": \"$public\",\n\t\t\t\"password\": \"$private\"\n\t\t}\n\t}\n}" > /home/$user/.composer/auth.json
 chown $user:$user /home/$user/.composer/auth.json

domain2=${domain//www./}
echo "$domain2"

runuser -l  $user -c "rm -f -r ~/web/$domain2/public_html/index.html"
runuser -l  $user -c "rm -f -r ~/web/$domain2/public_html/robots.txt"

#cd /home/$user/web/$domain2/public_html/
echo "/home/$user/web/$domain2/public_html/."


if [ -z $version ]; then
    runuser -l  $user -c "/home/$user/.composer/composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition /home/$user/web/$domain2/public_html/"
else
    runuser -l  $user -c "/home/$user/.composer/composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=$version /home/$user/web/$domain2/public_html/"

fi


db_user=$( head /dev/urandom | tr -dc a-z0-9 | head -c 6);
db_password=$( head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16);
fdb_user=$(echo "$user"_"$db_user");

echo "$user_$db_user";

v-add-database $user $db_user $db_user $db_password "mysql" "localhost"

runuser -l $user -c "/home/$user/web/$domain2/public_html/bin/magento setup:install --base-url=https://$domain/ \
--base-url-secure=https://$domain/ \
--db-host=localhost --db-name=$fdb_user --db-user=$fdb_user --db-password=$db_password \
--admin-firstname=$fname --admin-lastname=$lname --admin-email=$email \
--admin-user=$admin --admin-password=$password --language=$language \
--currency=$currency --timezone=$timezone --use-rewrites=1 \
--search-engine=elasticsearch7 --use-secure-admin=1 --use-secure=1 \
--cache-backend=redis --cache-backend-redis-server=127.0.0.1 --cache-backend-redis-db=$backend \
--page-cache=redis --page-cache-redis-server=127.0.0.1 --page-cache-redis-db=$redis"


v-add-cron-job $user "*/5" "*" "*" "*" "*" "/usr/bin/php7.4 /home/$user/web/$domain2/public_html/bin/magento cron:run"

And has been working fine since. So will not edit it …

Create first the user via Hestia + Webdomain (Via Hestia) and you should be fine

this is still wrong or at least bad practise. your webserver should not run your page and scripts as www-data in the first place but instead properly switch to the user you created in hestiacp and where the files are under. the owner and group of all files should belong to this user by default and therefore it is important that you run the installation of magento from that user to begin with.

changing the group to www-data and allowing write permissions to that group is merely a workaround but really not a good one. think about environments where you would have different customers share the server. if everyone runs as www-data you can actually cross connect/access foreign data and that’s a big security risk. just saying…

congrats on getting it up and running though! and thanks for documenting as well, I think there will be more people looking for that info :wink:

Set up Magento cron using the command line. You can verify that they’re working from the command line as well. They don’t show in HestiaCP – cron will show 0 even though they’re up and running.

Congrats on the the successful installation!