javacrafter-cms

How to set site in Crafter CMS?


I used Crafter CMS for building site. Now I redirect my domain to server, but it shows "No Site Set" message. How can I make site visible?

For information it works, when I use testing view:

http://<address>:<port>/?crafterSite=mysite

I want that it will be show when I enter to this address

http://<address>:<port>/

Solution

  • If you want to stay with multi-tenancy (managing many sites with Crafter), then you simply front Engine with a WebServer to automatically indicate the crafterSite in the URL. As an added bonus, you'll have the WebServer serve the static assets which is much faster. Here is an example vhost configuration for Apache HTTPd:

      <VirtualHost *:80>
        ServerName example.com
    
        DocumentRoot /path_to_crafter/crafter/data/repos/sites/mysite
    
        RewriteEngine On
        RewriteRule (.*) $1?crafterSite=mysite [QSA,PT]
    
        ProxyPreserveHost On
    
        ProxyPass / ajp://localhost:8009/
        ProxyPassReverse / ajp://localhost:8009/
    
        ErrorLog ${APACHE_LOG_DIR}/mysite-error.log
        CustomLog ${APACHE_LOG_DIR}/mysite-access.log combined
      </VirtualHost>
    

    Alternatively, if you just want to run a single site, you may disable multi-tenancy and have Engine deliver a single site. This link has more detail on that: https://docs.craftercms.org/en/3.0/system-administrators/engine/configure-engine-multi-tenancy.html