Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
© 2022 Yandex.Cloud LLC
Yandex Object Storage
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Buckets
      • Creating a bucket
      • Deleting a bucket
      • Limiting the maximum size of a bucket
      • Allowing public access to a bucket
      • Bucket encryption
      • Managing object lifecycles
      • Managing CORS configurations
      • Managing bucket policies
      • Managing bucket versioning
      • Editing a bucket ACL
      • Enabling logging
    • Objects
      • Uploading an object
      • Getting information about an object
      • Downloading an object
      • Getting a public link to an object
      • Deleting an object
      • Deleting all objects
      • Deleting a partially uploaded object
      • Editing an object ACL
    • Static website hosting
      • Hosting setup
      • Support for your own domain
      • Support for multiple domain names
      • Configuring HTTPS
    • Access management
      • Applying an access policy
  • Practical guidelines
    • Getting object query statistics with S3 Select
    • Getting website traffic statistics with S3 Select
    • Generating a billing report with resource break-down using S3 Select
    • Server-side encryption
    • Integrating an L7 load balancer with the CDN and Object Storage
    • Blue-green and canary deployment
    • Analyzing logs in DataLens
  • Concepts
    • Overview
    • Bucket
    • Objects
    • Bucket versioning
    • Object lifecycles
    • CORS
    • Static website hosting
    • Pre-signed URLs
    • Multipart upload
    • Access control lists (ACLs)
    • Bucket Policy
    • Uploading files via an HTML form
    • Storage class
    • Logging actions with a bucket
    • Backups
    • TLS protocol
    • S3 Select query language
    • Quotas and limits
  • Tools
    • All tools
    • Console clients
      • AWS CLI
      • S3cmd
    • File browsers
      • CyberDuck
      • WinSCP
    • SDK
      • AWS SDK for Java
      • Python SDK (boto)
      • The AWS SDK for .NET
      • AWS SDK for C++
      • AWS SDK for PHP
      • AWS SDK for Go
    • FUSE
      • GeeseFS
      • s3fs
      • goofys
    • FTP
      • Docker container for (S)FTP(S)
  • API reference
    • REST (Amazon S3-compatible)
      • How to use the API
      • Signing requests
      • API reference
        • All services and methods
        • Bucket
          • All methods
          • create
          • getBucketEncryption
          • getMeta
          • listObjects
          • listBuckets
          • deleteBucket
          • deleteBucketEncryption
          • putBucketEncryption
          • putBucketVersioning
          • getBucketVersioning
          • putBucketLogging
          • getBucketLogging
          • listObjectVersions
        • Object
          • All methods
          • upload
          • get
          • copy
          • getObjectMeta
          • delete
          • deleteMultipleObjects
          • options
          • selectObjectContent
        • Multipart upload
          • General multipart upload procedure
          • startUpload
          • uploadPart
          • copyPart
          • listParts
          • abortUpload
          • completeUpload
          • listUploads
        • Static Website Hosting
          • All methods
          • upload
          • get
          • delete
          • Static website response codes
        • CORS
          • All methods
          • XML structure of CORS configuration
          • upload
          • get
          • delete
        • Lifecycles
          • All methods
          • XML structure of lifecycle configuration
          • upload
          • get
          • delete
        • ACL
          • All methods
          • XML structure of ACL configuration
          • objectGetAcl
          • objectPutAcl
          • bucketGetAcl
          • bucketPutAcl
        • Bucket Policy
          • All methods
          • GetBucketPolicy
          • PutBucketPolicy
          • DeleteBucketPolicy
          • Data schema
          • Actions
          • Conditions
        • Common request headers
        • Common response headers
        • Responses
    • gRPC and REST
      • Authentication in the API
      • gRPC
        • Overview
        • BucketService
        • OperationService
      • REST
        • Overview
        • Bucket
          • Overview
          • create
          • delete
          • deleteHTTPSConfig
          • get
          • getHTTPSConfig
          • getStats
          • list
          • setHTTPSConfig
          • update
  • Access management
  • Pricing policy
    • Current pricing policy
    • Archive
      • Before January 1, 2019
      • From January 1 to March 1, 2019
  • Questions and answers
  1. Concepts
  2. Static website hosting

Static website hosting

Written by
Yandex.Cloud

    You can host your static website in Object Storage. A static website is based on client-side technology such as HTML, CSS, and JavaScript. It may not contain any scripts that run on the web server side.

    Note

    To enable hosting, you need public access to the bucket. Otherwise, Object Storage returns a 403 error code to the user trying to access the website.

    Object Storage lets you configure a bucket:

    • For static website hosting.

      Upload to the bucket the content of your site and specify the main page of the site
      <WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
        <IndexDocument>
            <Suffix>index.html</Suffix>
        </IndexDocument>
        <ErrorDocument>
            <Key>error.html</Key>
        </ErrorDocument>
      </WebsiteConfiguration>
      
    • To redirect all requests.

      You can specify the host to which all requests will be redirected, and also specify the protocol for transmitting requests.
      <WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
        <RedirectAllRequestsTo>
            <HostName>example.com</HostName>
            <Protocol>http</Protocol>
        </RedirectAllRequestsTo>
      </WebsiteConfiguration>
      
    • For conditionally redirecting requests.

      Using routing rules, you can redirect requests based on the object name prefixes or HTTP response codes. You can redirect an object request to other web pages (if the object was deleted) or redirect the requests that return errors.

      Example of a rule that redirects a request to a remote folder to another page
      <WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
        <RoutingRules>
          <RoutingRule>
            <Condition>
              <KeyPrefixEquals>temp/</KeyPrefixEquals>
            </Condition>
            <Redirect>
              <ReplaceKeyWith>folderdeleted.html</ReplaceKeyWith>
            </Redirect>
          </RoutingRule>
        </RoutingRules>
      </WebsiteConfiguration>
      

    You can configure static website hosting, redirection for all requests, or conditional request redirection using the Yandex Cloud management console.

    All the hosting settings are available through the Amazon S3-compatible HTTP API.

    After you configure the bucket for hosting, the website becomes accessible at:

    http(s)://<bucket_name>.website.yandexcloud.net
    

    or

    http(s)://website.yandexcloud.net/<bucket_name>
    

    Note

    By default, a bucket with a dot in the name is only available over HTTP. To grant it HTTPS support, upload your own security certificate to Object Storage.

    When accessing the website, you get responses with the codes described in Static website response codes.

    When hosting a website, you can:

    • Use your own domain.
    • Support multiple domain names.

    Was the article helpful?

    Language / Region
    © 2022 Yandex.Cloud LLC