3

I am quite new in Craft CMS 3. I have developed a new site and now I want to move it to the production server. I have just moved all the files by FTP, moved the database, changed .env variables.

enter image description here

But when I go to the URL I get a message: "Forbidden You don't have permission to access / on this server."

If I go to URL/web then I get the first page but without images.

URL/admin shows "Not Found The requested URL /admin was not found on this server."

How do I deploy the site? I cannot find a good article/help about deployment for Craft 3.

4
  • 1
    It's not about the deployment (moving/changing files) it's about the configuration of your server. Your root directory should be path/to/craft/web so you access web/index.php when you enter the normal url. Your url rewrite module should be on. You don't see any images because the file paths are messed up when you don't point to the web folder. You don't see the cp because you either entered the wrong url (web/index.php?p=admin) or your rewrite module is not on or you didn't move the htacces file. github.com/craftcms/docs/blob/master/en/… Commented Jan 7, 2018 at 0:16
  • Thanks Robin! I have .htacces in the /web/.htaccess folder, but I need another one in the root, right? Where can I find an example of root/.htaccess with redirection to /web? Maybe I need something more in this file? Why my craft 3 installation does not have it?
    – podeig
    Commented Jan 7, 2018 at 21:30
  • There is no example or existing htacces because you don't need it. As I said your root folder for your vHost/your url should be the web folder. No one should ever have access to /path/to/craft only to /path/to/craft/web Commented Jan 8, 2018 at 4:35
  • I´m in the same problem here, is there any guideline in the Craft docs to do this? I have to change the root directory on the host? I read that some folder need to be uno level up from the root for security reasons ( as craft 2 ), what folders, and how to configure the new path to them? This point it´s not clear for me. Commented Nov 24, 2018 at 14:14

2 Answers 2

3

This looks like a well visited question, its easy as something like this with apache2:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/web/

        <Directory /var/www/html/web/>
           Options FollowSymLinks
           AllowOverride None
           Require all granted
        </Directory>
</VirtualHost>

This is just a sample vhost file, but the real important part here is that you have the web folder set as your document root. This of course wont help anyone not using apache.

1

This article might be useful to you; there is a section on how to deploy Craft CMS 3 as well:

Setting up a New Craft CMS 3 Project

We also recently did a podcast on Website Deployment without Tears

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.