Custom S3 bucket

Custom S3 Bucket requires the SMALL plan or above.

You can store the discussion to your own S3 bucket and make search engines crawl the content under your own domain. Also good for backup. Here’s how you provide your bucket name: custom-s3Then you need to have a matching S3 bucket on Amazon with write permissions. Here’s how add one:

  1. Login to your AWS management console
  2. Click S3. Find your bucket or create a new bucket to the US standard region.
  3. Right-click to bucket properties
  4. Click Permissions from the right
  5. Click “Add more permissions”
  6. Add “moot-aws@moot.it” to the Grantee field and enable “Upload / Delete” checkbox

Without the permission we won't have access to drop anything there!

Proxy Content From Your Bucket

Now you will have the ability to proxy static content through your S3 bucket instead of muut.com/i/, thus allowing you to disable indexing at muut.com so the content will only be indexed at your domain. You will first have to set up the S3 bucket to be publicly accessible as statically hosted content. Under the Permissions section of your bucket’s properties, click Add bucket policy. In the text field that opens, enter the following code block, but with your bucket name substituted:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::YOURBUCKETNAME/*"
        }
    ]
}

Save the policy, and then in the Static Website Hosting section of your bucket’s Properties, select Enable website hosting and enter your community name in the “Index Document” field (this will only be possible after the static indexes have been generated on your bucket at lease once). Then Save the setting and if you then visit your bucket’s publicly accessible URL (eg. YOURBUCKETNAME.s3-website-us-east-1.amazonaws.com/i/) you will see the index of your forum’s static content.

Links in your S3 bucket static page will not function properly when accessed this way. This is normal.

The final step is to set up the proxy from your website’s server. This will display Muut's static pages on your website, instead of muut.com. By default, static pages reside on Muut’s servers. This can be changed to, instead, reside on your own server. First you need to change the URL on the Muut placeholder tag. Change from this:

<!-- Static content on Muut servers -->
<a class="muut" href="https://muut.com/i/your_forumname">
  Acme forums
</a>

to this:

<!-- Static content on your servers -->
<a class="muut" href="/i/your_forumname">
  Acme forums
</a>

Next you need to configure your webserver to serve this content from muut.com.

Keep a close eye on the code difference between default and S3 bucket forwarding. In the examples, you simply have to replace http://muut.com/i with your S3 bucket’s public URL. These are notated/commented in the code below.

NGINX config
server {
  listen 80;
  server_name domain.com;
  # Muut configuration (this location block only)
  location ~* ^/i/ {
    proxy_pass https://muut.com;
    # OR your S3 bucket URL
  }
  location ~* ^/m/ {
    proxy_pass https://muut.com;
  }
}
Apache virtual host config
# Load these modules if not currently loaded
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so

<VirtualHost *:80>
  # Add this to your VirtualHost
  SSLProxyEngine On
  ProxyPass /i https://muut.com/i
  ProxyPassReverse /i https://muut.com/i
  # OR your S3 bucket URL (no /i on the end)
  ProxyPass /m https://muut.com/m
  ProxyPassReverse /m https://muut.com/m
</VirtualHost>
Apache .htaccess config
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^i/(your-community-name)(/.*)?$ http://muut.com/i/$1$2 [P]
  # OR your S3 bucket URL (no /i in the middle)
  RewriteRule ^m/(.*)$ http://muut.com/m/$1 [P]
</IfModule>
IIS 7 Web server web.config
<rewrite>
  <rules>
    <rule name="Muut Index Rewrite" stopProcessing="true">
      <match url="^i/(.*)" />
      <action type="Rewrite" url="https://muut.com/i/{R:1}" />
    </rule>
    <rule name="Muut Media Rewrite" stopProcessing="true">
      <match url="^m/(.*)" />
      <action type="Rewrite" url="https://muut.com/m/{R:1}" />
    </rule>  
  </rules>
</rewrite>

The /m path is used for loading styles and scripts so you can customize with CSS. These /m proxy rules must remain pointing to https://muut.com/m. If you have a working configuration for a different web server such as IIS or Lighttpd, please be kind and send it to info@muut.com. Thank you!

You should also disable indexing on your muut settings so that if you have a custom bucket the content is not present in both locations.