3

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>/
totali
  • 260
  • 6
  • 22

2 Answers2

3

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

sumerz
  • 1,346
  • 7
  • 4
  • Dear @sumerz, thanks for reply. I did it, but in this case /static-assets/ not loads if I enter with domain name. It is ok, when I enter to site with ip address. Can you help me with this issue? – totali May 19 '18 at 15:56
  • Can you post your HTTPd configuration (you can replace your domain name with example.com) For some reason the crafterSite ID is not being added to your static asset requests before they proxy. Another option is to set your docroot to sit on top of the deploy directory using the docroot direct in Apache HTTPD DocumentRoot "/CRAFTER_INSTALLPATH/repos/sites/YOUR_SITEID_HERE" – Russ Danner May 20 '18 at 15:48
  • @totali I missed DocumentRoot directive, it's now added to the configuration above. Make sure it's pointing to the site's repo (the configuration I have above is typical for a `delivery` node. – sumerz May 20 '18 at 21:54
1

If you have a web server proxying to Tomcat:

For you domain's host/vhost add a simple rewrite rule which adds ?crafterSite=SITEID to each request before the request is proxied.

There's more information here: https://docs.craftercms.org/en/3.0/system-administrators/engine/configure-engine-multi-tenancy.html

Russ Danner
  • 693
  • 3
  • 11
  • Dear Russ, thanks for reply. I did it, but in this case external files (css, js, images) not loads if I enter with domain name. It is ok, when I enter to site with ip address. Can you help me with this issue? – totali May 19 '18 at 13:35