<p><em>Note 1: If you are not yet using Git for your PHP project, you can use <code>git clone https://github.com/Laradock/laradock.git</code> instead.</em></p>
<p><em>Note 2: To keep track of your LaraDock changes, between your projects and also keep LaraDock updated. <a href="#keep-tracking-LaraDock">Check this</a></em></p>
<p><em>Note 3: In this case the folder structure will be like this:</em></p>
<pre><code>- project1
- laradock
- project2
- laradock
</code></pre>
<h5 id="a-2-setup-environment-first-then-create-project:d680e8a854a7cbad6d490c445cba2eba">A.2) Setup environment first then create project:</h5>
<p><em>(In case you don't have a project, and you want to create your project inside the Docker environment)</em></p>
<p>1 - Clone this repository anywhere on your machine:</p>
<p>Note: In this case the folder structure will be like this:</p>
<pre><code>- projects
- laradock
- myProject
</code></pre>
<p>2 - Edit the <code>docker-compose.yml</code> file to map to your project directory once you have it (example: <code>- ../myProject:/var/www</code>).</p>
<p>3 - Stop and re-run your docker-compose command for the changes to take place.</p>
<pre><code>docker-compose stop &amp;&amp; docker-compose up -d XXXX YYYY ZZZZ ....
</code></pre>
<h4 id="b-setup-for-multiple-projects:d680e8a854a7cbad6d490c445cba2eba">B) Setup for Multiple Projects:</h4>
<p>1 - Clone this repository anywhere on your machine:</p>
<p>3 - You can access all sites by visiting <code>http://localhost/project1/public</code> and <code>http://localhost/project2/public</code> but of course that's not very useful so let's setup NGINX quickly.</p>
<p>4 - Go to <code>nginx/sites</code> and copy <code>sample.conf.example</code> to <code>project1.conf</code> then to <code>project2.conf</code></p>
<p>5 - Open the <code>project1.conf</code> file and edit the <code>server_name</code> and the <code>root</code> as follow:</p>
<pre><code> server_name project1.dev;
root /var/www/project1/public;
</code></pre>
<p>Do the same for each project <code>project2.conf</code>, <code>project3.conf</code>,...</p>
<p>6 - Add the domains to the <strong>hosts</strong> files.</p>
<pre><code>127.0.0.1 project1.dev
</code></pre>
<p>7 - Create your project Databases. Right now you have to do it manually by entering your DB container, until we automate it soon.</p>
<li>Upgrade to Docker <a href="https://www.docker.com/products/docker">Native</a> for Mac/Windows (Recommended). Check out <a href="#upgrading-laradock">Upgrading LaraDock</a></li>
<li>Use LaraDock v3.* (Visit the <code>LaraDock-ToolBox</code><a href="https://github.com/laradock/laradock/tree/LaraDock-ToolBox">Branch</a>).</li>
<p><strong>Warning:</strong> If you used an older version of LaraDock it's highly recommended to rebuild the containers you need to use <a href="#Build-Re-build-Containers">see how you rebuild a container</a> in order to prevent errors as much as possible.</p>
</blockquote>
<p><br></p>
<p>1 - Run Containers: <em>(Make sure you are in the <code>laradock</code> folder before running the <code>docker-compose</code> commands).</em></p>
<p><strong>Example:</strong> Running NGINX and MySQL:</p>
<pre><code class="language-bash">docker-compose up -d nginx mysql
</code></pre>
<p><strong>Note</strong>: The <code>workspace</code> and <code>php-fpm</code> will run automatically in most of the cases, so no need to specify them in the <code>up</code> command. If you couldn't find them running then you need specify them as follow: <code>docker-compose up -d nginx php-fpm mysql workspace</code>.</p>
<p>You can select your own combination of Containers form the list below:</p>
<p><strong>Note:</strong> You can add <code>--user=laradock</code> (example <code>docker-compose exec --user=laradock workspace bash</code>) to have files created as your host's user. (you can change the PUID (User id) and PGID (group id) variables from the <code>docker-compose.yml</code>).</p>
<p><br>
3 - Edit your project configurations.</p>
<p>Open your <code>.env</code> file and set the <code>DB_HOST</code> to <code>mysql</code>:</p>
<p><em>If you want to use Laravel and you don't have it installed yet, see <a href="#Install-Laravel">How to Install Laravel in a Docker Container</a>.</em></p>
<p><br>
4 - Open your browser and visit your localhost address (<code>http://localhost/</code>).</p>
<p><br>
<strong>Debugging</strong>: if you are facing any problem here check the <a href="#debugging">Debugging</a> section.</p>
<p>If you need a special support. Contact me, more details in the <a href="#Help">Help &amp; Questions</a> section.</p>