<p>At the risk of "link" answers, we talk about different deployment strategies here:</p>

<ul>
<li><a href="https://devmode.fm/episodes/website-deployment-without-tears" rel="nofollow noreferrer">Website Deployment without Tears</a></li>
</ul>

<p>...and there's a writeup of deploying Craft CMS here:</p>

<ul>
<li><a href="https://nystudio107.com/blog/setting-up-a-craft-cms-3-project#deploying-craft-cms" rel="nofollow noreferrer">Setting up a New Craft CMS 3 Project</a></li>
</ul>

<p>It's hard to do a TL;DR on this, because it's fairly involved, but essentially ignore your <code>vendor/</code> directory, and do a <code>composer install</code> on your production/staging server to install the <code>vendor/</code> directory there, synced up with your <code>composer.lock</code></p>

<p>Using some kind of deployment tool like <a href="https://forge.laravel.com" rel="nofollow noreferrer">Forge</a> or <a href="https://buddy.works/" rel="nofollow noreferrer">Buddy.works</a> will also make your life easier.</p>

CC BY-SA 4.0
2018-11-24T17:40:43.547Z
Thanks for your help. I still wonder what the second link should be, because that's now the same url as your first link, but yesterday I was listening to your podcast and it's pretty great! I'll listen to some more later. I am one of the users that uses git for every project, but somehow I didn't know about the trick with hooks to update the server. I'm trying that out now. Maybe Forge and Buddy.works will be the next step, but first setting up git on my server! Thanks
Friksel
CC BY-SA 4.0
2018-11-24T22:33:08.020Z
I updated the link to the second one; sorry. It should have been this: [Setting up a New Craft CMS 3 Project](https://nystudio107.com/blog/setting-up-a-craft-cms-3-project#deploying-craft-cms)
andrew.welch
CC BY-SA 4.0
2018-11-23T17:36:27.047Z
2018-11-24T22:32:45.123Z
2018-11-24T22:32:45.123Z
andrew.welch
<p>I install Craft CMS generally via composer on my local system and copy the files preferably via git to the server. I have one project where i have to copy files via ftp, thats a bit more complicated but it works. If i make updates locally i can see, what files changed in my git repository and know what i have to upload via ftp. Just make sure you add all important files to your git repo (included /vendor). </p>

<p>Regarding the web root: Copy all files to /public_html on your server and make sure the web root then points to the Craft /web directory! </p>

CC BY-SA 4.0
2018-11-24T17:37:18.467Z
Thanks for the confirmation on the /public_html. I thought I read somewhere that craft needed to be in some higher folder. But it looks like that's not needed. Which makes everything a lot easier. I am trying now to setup my git system to expand to remote pushes. Somehow I didn't know about it before, but it seems like a great solution! Thanks
Friksel
CC BY-SA 4.0
2018-11-23T12:00:15.917Z
2018-11-23T12:00:15.917Z
phaetons
<p>I want to deploy a local craftCMS 3 website to a server, but I didn't manage to get answers to some of the questions I have rightnow on Google search. So I hope you can help me with this and can help me finding the right / a better workflow to do these things instead of me reinventing the wheel.</p>

<p>I have the website build locally and want to deploy it. I installed composer on the webserver via SSH by putty (Win) and installed Craft 3 on the server with composer and the craft webinstaller whithout any problems. But that's obviously just an empty craftcms and not the locally build cms.</p>

<p>These are the questions I have right now:</p>

<p><strong>1) What's the preferred way to install a build craft website on the server?</strong> Do you use the craft installer or just copy all local files of the project to the server by FTP?</p>

<p>When creating a new craft project with composer the 'public' files are in 'web'. So if I install a new craft project with composer on the webserver inside public_html, the public files will be in <code>domain.com/project/web</code> or in <code>domain/web</code> if I use public_html as a path.
But in both cases some critical files, like the config files with passwords and all, will be in the public_html folder.</p>

<p>Of coarse I use htaccess to protect things, but I'm not sure this is the right and secure location to have this folderstructure on the server as meant to be and wonder if the project should go on a higher folder instead with only 'web' exposed on public_html.</p>

<p><strong>2) What's the right location on the server to install the craft project to to keep everything secure, like having config, vendor and all 'out of sight'?</strong> Do you guys install craft directly in the public_html folder, or on a higher parent folder? And in case of the latter do you only have the 'web' folder inside public_html somehow (how to do that?)? So what's the right/preferred way/location to install Craft3 in a secure way?</p>

<p>With an older CMS/framework I used I just copied local files by ftp to deploy. But it seems like using composer is a better way to do this and like to improve my workflow. </p>

<p><strong>3) If you make changes to the website locally, how do you deploy them once the website is setup on the server?</strong> Do you just use ftp to upload your changed files (and update the database) or is there a better way to do this with composer?</p>

<p>I like to do things in a way that works best and the CMS is meant for instead of reinventing the wheel and do things differently than the 'standard'. Hope you guys can help. Thanks in advance!</p>

<deployment>
SOLVED: Best way to deploy Craft 3 to webserver?
# SOLVED: Best way to deploy Craft 3 to webserver?

(Asked by: username_0 on 2018-11-23)

I want to deploy a local craftCMS 3 website to a server, but I didn't manage to get answers to some of the questions I have rightnow on Google search. So I hope you can help me with this and can help me finding the right / a better workflow to do these things instead of me reinventing the wheel.

I have the website build locally and want to deploy it. I installed composer on the webserver via SSH by putty (Win) and installed Craft 3 on the server with composer and the craft webinstaller whithout any problems. But that's obviously just an empty craftcms and not the locally build cms.

These are the questions I have right now:

**1) What's the preferred way to install a build craft website on the server?** Do you use the craft installer or just copy all local files of the project to the server by FTP?

When creating a new craft project with composer the 'public' files are in 'web'. So if I install a new craft project with composer on the webserver inside public\_html, the public files will be in `domain.com/project/web` or in `domain/web` if I use public\_html as a path.
But in both cases some critical files, like the config files with passwords and all, will be in the public\_html folder.

Of coarse I use htaccess to protect things, but I'm not sure this is the right and secure location to have this folderstructure on the server as meant to be and wonder if the project should go on a higher folder instead with only 'web' exposed on public\_html.

**2) What's the right location on the server to install the craft project to to keep everything secure, like having config, vendor and all 'out of sight'?** Do you guys install craft directly in the public\_html folder, or on a higher parent folder? And in case of the latter do you only have the 'web' folder inside public\_html somehow (how to do that?)? So what's the right/preferred way/location to install Craft3 in a secure way?

With an older CMS/framework I used I just copied local files by ftp to deploy. But it seems like using composer is a better way to do this and like to improve my workflow.

**3) If you make changes to the website locally, how do you deploy them once the website is setup on the server?** Do you just use ftp to upload your changed files (and update the database) or is there a better way to do this with composer?

I like to do things in a way that works best and the CMS is meant for instead of reinventing the wheel and do things differently than the 'standard'. Hope you guys can help. Thanks in advance!

**Tags:** deployment

---

## 2 answers

### Answer by username_1 on 2018-11-23. Score: 3

At the risk of "link" answers, we talk about different deployment strategies here:

* [Website Deployment without Tears](https://devmode.fm/episodes/website-deployment-without-tears)

...and there's a writeup of deploying Craft CMS here:

* [Setting up a New Craft CMS 3 Project](https://nystudio107.com/blog/setting-up-a-craft-cms-3-project#deploying-craft-cms)

It's hard to do a TL;DR on this, because it's fairly involved, but essentially ignore your `vendor/` directory, and do a `composer install` on your production/staging server to install the `vendor/` directory there, synced up with your `composer.lock`

Using some kind of deployment tool like [Forge](https://forge.laravel.com) or [Buddy.works](https://buddy.works/) will also make your life easier.

> **Comments:**
> **username_0**: Thanks for your help. I still wonder what the second link should be, because that's now the same url as your first link, but yesterday I was listening to your podcast and it's pretty great! I'll listen to some more later. I am one of the users that uses git for every project, but somehow I didn't know about the trick with hooks to update the server. I'm trying that out now. Maybe Forge and Buddy.works will be the next step, but first setting up git on my server! Thanks  
> **username_1**: I updated the link to the second one; sorry. It should have been this: [Setting up a New Craft CMS 3 Project](https://nystudio107.com/blog/setting-up-a-craft-cms-3-project#deploying-craft-cms)  

---

### Answer by username_2 on 2018-11-23. Score: 2

I install Craft CMS generally via composer on my local system and copy the files preferably via git to the server. I have one project where i have to copy files via ftp, thats a bit more complicated but it works. If i make updates locally i can see, what files changed in my git repository and know what i have to upload via ftp. Just make sure you add all important files to your git repo (included /vendor).

Regarding the web root: Copy all files to /public\_html on your server and make sure the web root then points to the Craft /web directory!

> **Comments:**
> **username_0**: Thanks for the confirmation on the /public_html. I thought I read somewhere that craft needed to be in some higher folder. But it looks like that's not needed. Which makes everything a lot easier. I am trying now to setup my git system to expand to remote pushes. Somehow I didn't know about it before, but it seems like a great solution! Thanks  

---

