How to set up a web server for Magento 2.2

How to set up a web server for Magento 2 Reading Time: 6 minutes
Share on Pinterest

Important update: This tutorial was originally created for Magento 2.1.5, but Magento 2.2.2 requires some minor changes to the instructions to make these instructions work. Please, pay extra attention to any instructions marked in red as they will differ slightly from the original videos.

As a reminder, these instructions are for a clean Ubuntu server. If you’re using a pre-existing web server or using WHM/cPanel/Plesk then your results may vary.

Before I start, I just want to let you know that this series isn’t going to be for everyone. You might want to stick around if you’re interested to know how to create a web server for Magento 2 – for the purposes of curiosity or development.

But if technology scares you, I recommend setting up Magento 2 using a one-click installation method. I highly recommend Nexcess.net if you are looking for a simple method to get a Production Web Server up and running for Magento 2.

This article is best used in conjunction with the provided videos because I have timestamped the commands that I use so that they correlate with the video. This should make is easier for you to follow along.

What this article will cover

Like most things in life, there is more than one way of doing them. For this article, I have decided to use Ubuntu as my chosen Operating System, running Apache, MySQL and PHP 7. And then using Composer as my method to download Magento 2. These are the sections you will find as you scroll down:


Newsletter Subscription

How to create a Ubuntu Server

In order to create our web server for Magento 2, we need to use a server. One option is to use a Virtual Machine but for the purpose of this article, we will use service provided by DigitalOcean.com. Click this link will entitle you to $10 free credit to spend on your server.

How to start a Ubuntu 16.04 Server on DigitalOceon

Once you have registered with Digital Ocean, simply Create a Droplet. You only have to select:

  • The server type (Ubuntu)
  • The Size ($10/mo Package)
  • The Datacenter Region (The closest to your country)

And then you have hit ‘Create’. It takes 1-2 minutes to the server to be created, but once it has you will receive an Email with your SSH Root Login Credentials.

How to connect to your new server

Now that you have a server, you will need a way of connecting to it. In this article, I am working on a Windows machine so I will need to download Putty from Putty.org.

Once installed, you only need to enter the IP Address of your new server into the ‘Host Name (or IP address)’ Field and click ‘Open’.

How to create a new user – and grant it superuser privileges

Once you have successfully logged into your server using Putty, enter the following commands.

Create yourself a user [04:23]

Give this user ‘superuser’ or root privileges by adding it to the ‘sudo’ group [05:06]

How to disable the root user (for security)

**Before disabling root access completely, log out as the root user and relog as the new user. Once logged in as the new user, check that your ‘superuser’ access works. You can check this by switching to the root user and back again. If you followed the steps carefully, then you will not see an error

Access config file to disable root user login** [06:18]

Change the below line, then save and exit [06:32]

Reload the SSH Service for changes to take effect [06:58]

How to enable a basic firewall

First, you must allow SSH connections to your web server. This is the connection we are currently using. [07:58]

Then we turn on the firewall [08:26]


How to create a LAMP stack on Ubuntu

How to install Apache and configure it for Magento 2

Download the package lists from pre-selected repositories and update them on our web server. [01:32]

Install Apache [01:46]

Open Apache settings file to allow .htaccess file usage [02:38]

Add the below to the file, then save and exit [03:00]

Open Apache settings file to set the Global ServerName [03:24]

Add this line at the end of the file, then save and exit [03:35]

Check for any errors [04:02]

Enable Apache rewrite [04:40]

Restart Apache for any changes to take effect [04:52]

Enable Apache through the firewall [05:28]

How to install MySQL and secure the installation

MySQL is a database management system that allows the web server to store information that can be accessed by Magento. [06:22]

Run a MySQL security script that addresses some vulnerabilities [07:08]

How to install PHP and any extensions needed for Magento 2

PHP allows the web server to process code, run scripts and display dynamic content that Magento 2 uses. [08:36]

Important Update: Added php7.0-soap and php7.0-bcmath to command

Tell the webserver to prefer PHP files (move index.php to front of the list) [08:50]

Install PHP Modules for use with Magento 2 [09:52]

Restart apache for changes to take effect [10:08]

How to install phpMyAdmin and secure the installation

phpMyAdmin allows us to manage MySQL Databases using a Graphical User Interface, rather than having to use a Command Line Interface.

Install phpMyAdmin [Warning: Press space to select ‘apache2’ before hitting Enter to continue] [10:56]

Make sure that you select apache2 using your SPACE BAR before hitting ENTER to continue

Enable 2 phpMyAdmin required extensions [11:42]

Restart Apache for any changes to take effect [12:12]

phpMyAdmin Checks

Visit the phpMyAdmin portal you’ve just created via a web browser to ensure the page loads HTTP://<your_server>/phpmyadmin


How to set file system permissions

How to create a new web user

The reason for creating a new web user is for added security. The main user that we created (e.g. ‘craig’) has the ability to run superuser commands if required, where the web user would never need such privileges. Also, having a dedicated web user on the server means not having to keep updating folder/file permissions whenever you add or move files.

Add the user (I’ve called my user ‘magento’) [01:38]

How to add the user to the web servers primary group

Make the web server group the primary group for the new user [02:30]

How to set folder permissions

Update the root file ownership to coincide with our new web user [03:12]


How to install Composer and download Magento 2

Where to obtain our Magento Access Keys

Before you do anything, be sure to visit https://marketplace.magento.com and create an account. Then you can generate a set of access keys that will allow you to download from the Magento reporistory.

How to install Composer

To install composer, complete the 2 commands [01:56]

How to download Magento 2 via Composer

Move to the web directory [02:35]

Switch to the ‘magento’ user [02:58]

Be sure to empty the web directory before running the below command (I forgot to do this in the video). Use rm index.html to clear out the Ubuntu Default Page.

Run the command to download Magento 2 from the marketplace repository [03:26]

Warning: Don’t miss the full-stop on the end of the command

Remember that Username = Public Key and Password = Private Key

Set pre-installation permissions

Update the directory permissions [05:42]

Important Update: Added generated to command

Update the file permissions [05:44]

How to set pre-installation permissions

Update ownership execution permissions [05:46]


How to create a database ready for installing Magento 2

How to create a user and database for Magento 2

Luckily are no commands to reference in this video.


How to install Magento 2 via the Setup Wizard

How to install Magento using the Setup Wizard

This part of the video doesn’t refer to any commands. However, be sure to access the Wizard via http://123.123.123.123/setup (123.123.123.123 would be your own IP address)

How to setup the post-installation Folder Permissions

The last folder we have to modify here (run whilst still logged in as ‘magento’ user) [06:12]

How to setup Cron Jobs

If you get a prompt asking which editor to use when running the below command, select option 2 (nano). That’s the text editor we’ve been using throughout these videos.

Open our crontab in order to add commands that can be run to automate Magento tasks [06:40]

At the bottom of the file, simply add these 3 lines [07:00]


Summary on how to create a web server for Magento 2

I hope that you found the video and article useful. Remember, that this article is not to be used without watching the videos. Let me know in the comments below how you get on.

Leave a comment below

 

Craig

Craig

I've spent a chunk of my career working in eCommerce for a FTSE 100 company where I've worked in Web Development/Design, SEO and assisted in running an eCommerce business. If I can help anyone out, then I'll try my best.
Craig
Share on Pinterest

Comments

  1. marc

    Hi Craig, thanks for your manuals and vids, they’re fun to follow. The versions have all changed already (Ubuntu, Magento 2.5 ? etc..), I’m not sure if I installed all the needed packages and extensions since they’ve changed, but at least mysql and phpmyadmin work. I also downloaded Magento with Composer. Now I need to create a DB user for Magento. I cannot login though, which step did I miss? If I remember well I disabled root login to the DB. In your vid, wit phpmyadmin, it isn’t clear which user you’re using. Could you please help? Should I re-enable root login, create a DB User for Magento, and run the security-configuration script again? Greets 😉

    1. Craig Post author

      Hi Mark, thanks for your positive comments. I’ve actually got an Magento 2.3 video in the works because a few things have changed since I originally produced the videos 2.2. If you can wait a couple of weeks, I should have the answers you’re after in the video. If you can’t wait, please report your question on our Forum – It’s easier to have a discussion on that platform. If you can’t access phpMyAdmin to create a Magento user, then simply run “sudo mysql_secure_installation” (as you say), and make a note of your new mySQL root password (and keep it safe). Then redo the steps in episode #06. Side-note: Disabling mySQL root access shouldn’t be an issue if localhost login is still enabled. If you want to discuss further, pop onto the forum 🙂

      1. marc

        I read somewhere that with the newer version of mysql phpmyamin cannot use root anymore to connect… or I didn’t get it 😛
        Sorry I haven’t checked the forum yet, I’ll try later.

        1. Craig Post author

          So, I just ran into the same issue when installing phpMyAdmin with Ubuntu 18.04. Looks like you have to create your User/Database via the Command Line now. Thanks for bringing to my attention.

    2. marc

      OK I managed to change the pwd of the DB-User “phpmyadmin” via ssh and I can use that to connect using phpmyadmin now. I’ll try to continue with the DB-creation video using that user. But I’m not sure if doing so can be a security issue. I’m not used to DBMS security, unfortunately.

      1. Craig Post author

        Sound. It’s usually good practice for One User Per Database, that can only connect via localhost. You’ll always want access to a “root user” (not necessarily “root”) in order to manage mySQL in the future. On top of that, it’s good practice to whitelist access to phpMyAdmin (via APache/NginX) so only your IP can load the page.

        1. marc

          Hi Craig, that’s crazy how fast you answer! Thanks a lot! Great site, great vids, great help. I really appreciate, that’s “wow” 😀 … Should I change to the forum? My Magento is working now, at least with http. I installed the latest Ubuntu Server OS, latest Apache Webserver and latest PHP module just using apt-get, more or less following your great and helpful instructions, but I haven’t checked which versions I’m using now (6th of december 18). A few php modules from your video/manual were deprecated, I didn’t install them, and it worked anyway. The biggest issue I had was that phpmyadmin user not working. I also checked the “https” box at the end of the Magento installation procedure though, and it messed up with something I guess. Maybe it’s a certificate issue, I’ll try to read the logs tomorrow. I cannot reach the config page either, it redirects me all the time to its https address which doesn’t work. I’ll check the forum now, but quickly cause it’s late (00:19, Switzerland, GMT+1 – I’m sure you’re still up too xD ), otherwise that thread’s gonna be huuuge. …Thanks again!

          1. Craig Post author

            Hey Marc. Yeah, to forum is just so much easier. I even wrote a post on their earlier relating to your issue (root login with phpmyadmin) and how I solved it. You’ll need to obtain an SSL Certificate and configure Apache to use it before enabling SSL in Magento – Otherwise you’ll get one of a few errors. Yeah, I didn’t even realise how late it was right now. Hopefully, I’ll see you over on the forums soon. Take care.

  2. moe

    Thank you for this tutorial,
    Do you know by chance if Vesta Control Panel could cause any conflict or issue respecting this tutorial? Actually I took a vps from digital ocean and first installed vesta which installed the whole LAMP stack for me easily, then I downloaded the magento 2 through composer but this time in the public_html document and changed the apache2 conf document root to be the public_html not /var/www/html. The issue here is when I browse to the ip address of my droplet cant reach the Magento setup page correclty, it keeps redirecting with blank page. Please help me if you know anything about this!

    Thanks Craig,
    moe

    1. Craig Post author

      Hi Moe.

      I don’t think I’d heard of Vesta Control Panel before until you just mentioned it. It’s entirely possible that this is having a negative effect on the desired result. One of the reasons why I stick to the steps in this article (even when creating my own servers) and stay methodical, is so that everyone (including myself) are always working in the same environment. This cuts out the variations and anomalies that give varied results between each user. “Sticking to the script” ensures that we’re all on a level playing field and allows us to easily reproduce and diagnose issues. I’d recommend following the steps completely, until you are comfortable with how everything fits together. And only then introduce your own variations such as installing other 3rd party solutions. Also bare in mind that this article doesn’t just install a LAMP Stack – It shows you show to configure it specifically for Magento 2. Sorry, I couldn’t assist further.

  3. comerciosite

    Friends I’m having error in PHP Extension pcntl, the magento setup does not continue until I install this extension.
    I searched the forums and google and everyone I installed continues giving error.
    Any suggestions from friends to pcntl Extension?
    I’m in Brazil and I’m watching all of Craig’s videos, I’m a fan. Congratulations Craig for the great teaching.

  4. Chris

    I’m stuck at the “Update the directory permissions [05:42]”

    I get the following error:

    find: ‘var’: No such file or directory
    find: ‘generated’: No such file or directory
    find: ‘vendor’: No such file or directory
    find: ‘pub/static’: No such file or directory
    find: ‘pub/media’: No such file or directory
    find: ‘app/etc’: No such file or directory

    When I “ls -a” in “/var/www/html” I get the following files only:

    composer.json .gitignore update

    Any idea? The update folder has the following files:

    app composer.json composer.lock cron.php dev .gitignore .htaccess index.php pub README.md var vendor

    What am I missing here?

    Great tutorial so far, very helpful.

    1. Craig Post author

      Hi Chris.

      It looks like you’ve not installed Magento via Composer into the correct directory. It looks like you ran the composer-create command from the correct directory (because /var/www/html/ contains composer.json and .gitignore which are generated in the folder you execute the command from), but the command may be incomplete.

      At this stage, I’d wipe the html/ directory. So go back to #5 just after you run ‘su magento’. Then purge the html/ folder by running ‘rm -rf composer.json .gitignore update’. Then you can carry on with the composer-create command. Just make sure you don’t miss the full-stop at the end of the command. Loads of people miss this. The full-stop at the end of the command tells composer to install it in the directory that you’re executing the command from.

      See how you get on.

    2. Chris

      After: “composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition .”

      I get the following:

      “Your requirements could not be resolved to an installable set of packages.

      Problem 1
      – Installation request for magento/product-community-edition 2.2.5 -> satisfiable by magento/product-community-edition[2.2.5].
      – magento/product-community-edition 2.2.5 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.

      To enable extensions, verify that they are enabled in your .ini files:
      – /etc/php/7.0/cli/php.ini
      – /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
      – /etc/php/7.0/cli/conf.d/10-opcache.ini
      – /etc/php/7.0/cli/conf.d/10-pdo.ini
      – /etc/php/7.0/cli/conf.d/15-xml.ini
      – /etc/php/7.0/cli/conf.d/20-calendar.ini
      – /etc/php/7.0/cli/conf.d/20-ctype.ini
      – /etc/php/7.0/cli/conf.d/20-curl.ini
      – /etc/php/7.0/cli/conf.d/20-dom.ini
      – /etc/php/7.0/cli/conf.d/20-exif.ini
      – /etc/php/7.0/cli/conf.d/20-fileinfo.ini
      – /etc/php/7.0/cli/conf.d/20-ftp.ini
      – /etc/php/7.0/cli/conf.d/20-gd.ini
      – /etc/php/7.0/cli/conf.d/20-gettext.ini
      – /etc/php/7.0/cli/conf.d/20-iconv.ini
      – /etc/php/7.0/cli/conf.d/20-intl.ini
      – /etc/php/7.0/cli/conf.d/20-json.ini
      – /etc/php/7.0/cli/conf.d/20-mbstring.ini
      – /etc/php/7.0/cli/conf.d/20-mcrypt.ini
      – /etc/php/7.0/cli/conf.d/20-mysqli.ini
      – /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
      – /etc/php/7.0/cli/conf.d/20-phar.ini
      – /etc/php/7.0/cli/conf.d/20-posix.ini
      – /etc/php/7.0/cli/conf.d/20-readline.ini
      – /etc/php/7.0/cli/conf.d/20-shmop.ini
      – /etc/php/7.0/cli/conf.d/20-simplexml.ini
      – /etc/php/7.0/cli/conf.d/20-soap.ini
      – /etc/php/7.0/cli/conf.d/20-sockets.ini
      – /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
      – /etc/php/7.0/cli/conf.d/20-sysvsem.ini
      – /etc/php/7.0/cli/conf.d/20-sysvshm.ini
      – /etc/php/7.0/cli/conf.d/20-tokenizer.ini
      – /etc/php/7.0/cli/conf.d/20-wddx.ini
      – /etc/php/7.0/cli/conf.d/20-xmlreader.ini
      – /etc/php/7.0/cli/conf.d/20-xmlwriter.ini
      – /etc/php/7.0/cli/conf.d/20-xsl.ini
      – /etc/php/7.0/cli/conf.d/20-zip.ini
      You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.”

      Has this got something to do with it?

      1. Chris

        I “su root” and entered my password and ran “sudo apt install php7.0-bcmath”.

        The install looks far healthier now, the other one took 2 seconds. I wonder what step I missed that bcmath wasn’t installed?

        Thanks for your help Craig. Very much appreciated!

      2. Craig Post author

        Magento 2.2.5 added ext-bcmath as a requirement, but these instructions were for 2.2.4. I’ve just not time to re-test this yet. If you want to push forward with 2.2.5, then try the following:

        Run that as your root user:
        ‘sudo apt-get install php7.0-bcmath -y’

        if that doesn’t install anything, try:
        ‘sudo apt-get install php-bcmath -y’

        Once the package has installed successfully, run ‘sudo systemctl restart apache2’ for the changes to take effect.

        Then you’ll just need to change back to your magento user, wipe the html folder and re-run the composer command.

        I’m not in a position where I can test this fully right now. But I’ll try to update this article tonight if you’re still struggling.

        EDIT: Ha, ok… It looks like you solved it whilst I was replying. Kudos for working it out yourself! If you don’t run into anymore issues, then it sounds like I only need to edit one line in these instructions. Please, let me know how you get on.

        1. Chris

          Thanks for the reminder to ‘sudo systemctl restart apache2’, this saved me.

          My first successful Magento 2 install! Thanks very much Craig, much appreciated.

          1. Chris

            PS. I also had to ‘sudo systemctl restart apache2’ after editing the cron file (last step).

          2. Craig Post author

            Awesome. Thanks for being my 2.2.5 Guinea pig. If you have any future queries or anything that you can’t find the answer to or you just want to start a discussion, try my new forum https://discuss.digitalstartup.co.uk

            Good luck for the rest of your project.

  5. Fahad Shakeel

    Thank you for this amazing tutorial it was working completely fine till last month but now PHP Extensions are not installing completely, some are missing such as simplexml, xsl, dom etc. I am trying to install them one by one but I am kind of afraid that I might be doing something wrong.
    Can you please go through this tutorial again and help me in solving this problem, I would be really grateful.
    Also how good is MariaDB for Magento?

    Thank you in advance.

    1. Craig Post author

      Hi Fahad, I saw your message on YouTube. I’ll copy what I replied to here as well:

      “Do you mean that the installation instructions don’t work anymore? Or that the installation you did has now stopped working? I need some more details to understand the problem. Nobody else has reported these issues, so this could be isolated to your setup (for whatever reason that might be).

      With reference to MariaDB, I’ve tried MySQL, MariaDB and Percona for Magento 1 and didn’t really notice anything spectacular. In Magento 2, I have only tried MySQL because of the warning I read on their documentation.”

    1. Craig Post author

      You’re very welcome, SirTordo. Good luck with the rest of your project 🙂

  6. Brayan

    Hi Craig,

    Awesome tutorial btw I went through the installation process and it went through but when I try to got to the admin page iI have 404 error, I did what Oscar did but is not working, I found out the composer installs everthing within the “project-community-edition” folder and not on var/www/html so checking out this : composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition
    it shows the end of the project installation location should be there, I did tried what u suggested post installation to move the folders from var/www/hml/project-community-edition to var/www/html but that’s what creates the 404 error post installation, what do you think this will solve the issue??
    Install it like this?

    composer create-project –repository-url=https://repo.magento.com/ magento
    or
    composer create-project –repository-url=https://repo.magento.com/ html

    Since I think creating it like this: composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition creates that extra location which mess everything up, or what do you suggest?

    Regards,

    1. Craig Post author

      Hey, how’s it going 🙂

      Glad you’re finding these tutorials useful. I recently installed another copy of Magento 2 on a dummy server and the composer create command worked fine. If you look at the composer create-project command carefully there is a space and a full-stop at the end. This ” .” at the end of the command tells composer to install Magento 2 in the current directory that you’re sitting in (which I would assume is /var/www/html/). Please, can you double check that you’re running the composer create-project command with the ” .” at the end. Let me know how you get on.

      You’ll have to completely delete everything in the /var/www/html/ folder first, otherwise composer won’t let you run the command. Watch out for any invisible files in the directory too. You can see all files (inc invisible files) by running “ls -la” whilst you’re in the folder. Or you could obviously wipe the server and start again – It’s good practice anyway. Lord knows I’ve done it enough times 🙂

  7. Matthias

    Hi Craig,

    fantastic videos and explanation. That really speeds things up!

    right now I am getting the error:

    Forbidden
    You don’t have permission to access / on this server.
    Apache Server at xxx.xxx.xx Port 443

    Do I have some issues with directory permissions or is it a apache config problem?

    Thanks and nice Weekend 🙂

    1. Craig Post author

      Hi Matthias, thanks for your positive comment.

      This guide didn’t cover 443/SSL so I’m assuming you’ve made your own tweaks for your purposes. If you’re receiving the Permission Error when testing your LAMP stack then it’s definitely a mis-step during the setup, so I’d go back over video #3.

      I can’t think of a reason why Magento would cause this issue during this setup, because unless you engaged SSL during the Web Setup Wizard then any attempt to visit a page via port 443 would redirect you to 80 instead.

      Please, let us know how you get on.

    1. Craig Post author

      Thanks! And well spotted. I’ve fixed this now 🙂

  8. Alexander Sandberg

    I have a question regarding secutity, what is the recommended things to do to minimize the risk of a data breach? Aka what do I as IT need to make sure I know before doing this as a live server? Any recommendations? I’m thinking digitalocean obviously have security on the network side but I still need to handle the vm. I’m asking because I’m a a bit nervous to be handeling userdata.

    1. Craig Post author

      Hi Alexander. It’s refreshing to see someone discuss security, as it’s so important in a production (live) environment to protect both you and your customers. I won’t give you a comprehensive how-to or anything, but I’m just going to real off some points from the top of my head regarding lite-usage of WEB SERVERS:

      • Firewalls: Restrict SSH/SFTP/FTP Access to a select few IP Addresses. If you don’t have a Static IP address with your ISP, then get one
      • Usernames: Disable all default usernames that maybe auto-generated (e.g. “admin”, “root”) and replace them with something obscure
      • Usernames: Don’t use obvious usernames like “John” or “Jdoe”
      • Passwords: This one feels obvious, but don’t use dictionary words
      • Passwords: Enforce using SSH Keys to replace your passwords
      • Users: Don’t use your ROOT user to access and work on your web files. Create server users specific for a purpose with restricted write/read access to specific working directories. This is a great one, because if this user is compromised, it helps to limit damage
      • Access: Only log into the server from computers you own

      In most cases, the firewall will save you from brute-force attacks. But also knowing I have regular backups helps me sleep at night. For more advice on Magento (Frontend) Security, you should checkout this video I did last year: 25 Ultimate Security Checks

    1. Craig Post author

      Well spotted, thank you. I didn’t realise they added that feature to 2.2. If anyone else is reading this, make sure you’re logged in as the ‘Magento file system owner’ before executing that command.

  9. soulsako

    magento@ubuntu-s-1vcpu-2gb-lon1-01:/var/www/html$ find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
    find: ‘var’: No such file or directory
    find: ‘generated’: No such file or directory
    find: ‘vendor’: No such file or directory
    find: ‘pub/static’: No such file or directory
    find: ‘pub/media’: No such file or directory
    find: ‘app/etc’: No such file or directory
    Hi people, can anybody please help me set pre-installation permissions. i am getting this error.

    1. Craig Post author

      Hi. The “find” command is run post-installation. If you’re getting “No such file or directory” then this would suggest Magento has not been installed in the “/var/www/html” directory. I would highly recommend checking the steps again.

      1. soulsako

        magento@ubuntu-s-1vcpu-2gb-lon1-01:/var/www/html$ ls -alh
        total 12K
        drwxr-xr-x 3 magento www-data 4.0K Mar 8 04:46 .
        drwxr-xr-x 3 root root 4.0K Mar 8 03:20 ..
        drwxr-xr-x 13 magento www-data 4.0K Mar 8 04:51 project-community-edition

        I have looked into the directory and there is project-community-edition there.

        1. Craig Post author

          The folder “project-community-edition” should not exist. The files you need are probably in that folder. Move the contents of that folder into “/var/www/html”.

          1. soulsako

            The previous problem is fixed but i am getting this new error whilst installing magneto using the setup wizard
            SQLSTATE[HY000] [1045] Access denied for user ‘magento’@’localhost’ (using password: YES)
            please help.

          2. Craig Post author

            Go back over episode 6. You either noted the username/password incorrectly when creating your user or did not click “Create database with same name and grant all privileges” before pressing “Go”.

    2. Derickt

      @soulsako I know this is 3 months ago (so im posting for others that might run into this), but have a look at your installation and check for any errors, also the command syntax for composer might have changed as you can specify an installation directory, if you don’t it defaults to ‘project-community-edition’
      composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition

      1. Derickt

        composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition installation directory name

  10. Ivan Tran

    This is a great tutorials. I successfully installed magento 2.2.2 on the ubuntu server.
    Now, I do fresh install magento 2.2.3 for another server but I got 404 error in admin page and front end home page missing styling and image. Do you know how to fix that? (I already tried clean cached and do this command $ php bin/magento setup:static-content:deploy and modify apache2 config
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    allow from all

    but still the same. Do you have any ideas?
    Thanks

    1. Craig Post author

      Hi Ivan. I’m glad you’ve found these videos of use. The problem you describe matches the exact symptoms of apache rewrite not being configured correctly. Have you tried what Ollie H did in his comment below this one?

      Regards,
      Craig

  11. Ollie H

    Hi Craig,

    You are an absolute champ, thanks you from the bottom of my heart for sharing your hard work and working setup, God knows I burnt out my fuse until I came across your article.

    One thing to note, I got everything smooth until the successful installation, when visiting the site it didn’t have and css, and admin page threw a 404 error at me, I fixed it with these commands:

    #a2dismod rewrite
    #sudo service apache2 restart
    #a2enmod rewrite
    #sudo service apache2 restart

    Strange since it was already enabled!

    Albeit, you are a true gentleman, God bless you,
    Ollie.

    1. Craig Post author

      Hi Ollie,

      You’re more than welcome. I can’t take all the credit as it’s the community that helps me stay on top of the changes as Magento gets updates.

      I’m glad you were able to solve your issue, and thank you for posting your problem/solution on here for others to learn from in case they face the same issues.

      Good luck with your Magento project, and I hope to see you around here again (Or on the YouTube Channel) in the future 🙂

  12. Fabio

    The best tutorial on the internet!

    You Sir, are a hero!

    1. Craig Post author

      You’re welcome, Fabio 🙂 Team effort though because the community lets me know if the instructions need changing when new updates come out. Good luck with your project!

  13. Daniel

    Hi this is super.
    only thing i cant fix is this permission check i have installed magento 2.2.2

    File Permission Check
    1 file permission not met. Hide detail

    The best way to resolve this is to allow write permissions for files in the following Magento directories and subdirectories. The exact fix depends on your server, your host, and other system variables.
    For help, see our File Permission Help or call your hosting provider.

    “/var/www/html/app/etc” – Writable.
    “/var/www/html/var” – Writable.
    “/var/www/html/pub/media” – Writable.
    “/var/www/html/pub/static” – Writable.
    “/var/www/html/generated” – Not writable, change the permissions. Show details
    * – In some cases, you might have two PHP configuration files: one for the PHP command line and for the web server. If so, make the change in both php.ini files. For details, see the php.ini reference.

    1. Craig Post author

      Thanks for sharing that. Depending on how you set up your users, your cron user must be the same as the file owner. In this guide, the cron is run as www-data and the file/folder owners are also www-data.

      This guide uses the two users setup. Check step 5 in the Official Magento DevDocs to ensure folders and permissions are correct.

  14. Remco

    Thank you for this tutorial. I managed to setup a test server.
    Some minor issues though. Some plugins for PHP were missing (Curl, intl and zip). I was able to install them with “sudo apt install php-missing_plugin”
    And opening the webbrowser on my server ip lead me to a white web page.
    I needed to open “my-server-ip/setup” to start the setup wizard.
    Again thanks for the tutorial.

    1. Remco

      small add-on:
      the map “generated” needed to change to the correct permissions as well.

    2. Craig Post author

      Thank you for the information. I’ll be going through these steps again soon as a lot seems to have changed since I wrote this for v2.1.5. I really appreciate you sharing this with myself and the community.

  15. Spike

    great article.
    I ‘ve engage an cosmetic issue during composer installation says missing extension of PHP-soap
    by adding sudo apt-get install php7.0-soap and reinstall the issue was resolved,

    1. Craig Post author

      Hi Spike. I appreciate you sharing this information. Thank you

  16. Ömür Yanıkoğlu

    Helo,

    Your training really helped me. I have never encountered an error. There’s just one thing. The current version is 2.2.0 but the theme I want to use is compatible with 2.1.9. For this reason, I needed to use the following code:

    composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition=2.1.9 .

    Thank you so much.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.