Deploy Laravel Project to AWS EC2: Step-By-Step

Finally! After all those preparations, we can see our project working in our browser.

Usually, NginX and PHP-FPM service runs as www-data user and it is a system user for services. In the best case scenario, we would like to isolate our web project from any system services and maybe have a different directory for example /home/web/demoproject as opposed to /var/www/html where you need root user explicitly.

  1. To add a new user enter the adduser web command as root. You will be prompted to define a password for a web user add fill in optional details. Make sure to choose a secure password.
root@ip-172-31-44-101:~# adduser web
Adding user `web' ...
Adding new group `web' (1001) ...
Adding new user `web' (1001) with group `web' ...
Creating home directory `/home/web' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for web
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y
  1. Now we can log in with a web user and create a structure for how we want our future laravel project served.

This lesson is only for Premium Members.
Want to access all lessons of this course?

You also get:

  • 59 courses (1057 lessons, 42 h 44 min total)
  • Premium tutorials
  • Access to repositories
  • Private Discord