Setting Up A Test Server For Laravel

I always used xmapp on windows to test the code i write before running it on a production server which was fine on till I started running into problems with one of my projects which rfine on my PC but not on the production server. So decided to look around for a good option for a test server and what I ended up with was PuPHPet, it’ s a great and fast way to setup a server.

First go onto PuPHPet.com, click “get started right away”. This will ask what you want it to run on which for me was virtualbox which you need to download and install first. For Distro i just used Ubuntu Xenial 16.04 LTS x64. Next under machines all you really need to change here is the Internal Identifier and Hostname. The rest of this page can be left the way it is.

Next on to “system package” page and the page after that “users and groups” we can leave both pages the way they are. For the next page Locale, i just changed my Default Locale and time zone for Ireland.
For the next few pages after firewall, Resolv, Cron Jobs, Custom Files i just left them the way they were.

After that we have the Nginx page which all i changed was the Server Name, Server Aliases, Project Root to what you would like.

No point in using ssl option as you can’t use Let’s Encrypt on localhost, for “virtual host location” a bit down the page I just set Location Root to the same as project root.The rest of the page can be left alone.

Next page “Install Apache” can obviously be left as we have Nginx, Let’s Encrypt page will be skipped to, the page after “PHP” can be left with its defaults. Ruby, Python, Nodejs pages can be left to. Next page is MariaDB which i unticked as i don’t want to install this, instead on the page after i ticked Install MySQL which i prefer to use, on this page you can setup database username and password under USERS, i left the rest the way it is for now.

You can skip all the rest of the pages PostgreSQL, MongoDB, Redis, SQLite MailHog, Beanstalkd, RabbitMQ, Elastic Search,Solr unless needed and finally after all the skipping you can “Download Your Customized Archive”.
After the download, I Created a folder within the C drive called SeanProjectSever and extracted the downloaded file to here.

Next open up cmd and cd to where you extracted the download to, so for me its C://SeanProjectServer and then type vagrant up, this will take a few minutes the first time to setup the server.

Next we open up putty (download if you don’t have it) and enter the IP address in to the hostname field, if you forgot your ip address for the server you can find it under your project folder in the config file within PuPHPet folder, open the config file and its next to the private_network line.
Also on the sidebar in putty click on SSH and then on the dropdown click on auth, then click browse under private key file authentication and locate the private key file setup by PuPHPet which will be used for login, for me was: C:SeanProjectServerpuphpetfilesdotsshid_rsa

After this go back to the main page(click Session near the top) and save, then click open, next I used the default username “vagrant” and the private key file will be used instead of a password, so now you should be logged in. So now update your server firstly:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

If you want to access your project by a url instead of ip, for me I setup www.seanproject.dev. You need to go to your host file in

c:windowssystem32driversetchosts

and add:

192.168.100.1 seanproject.dev www.seanproject.dev

Now you should be able to access your project like:

https:// www.seanproject.dev

After this you are ready to setup Laravel as you normally do within var/www folder.