space with my domain name

Good afternoon, please tell me how to bind Space to my domain, and how to make it open via https://example. looking at the guide in the documentation, I managed to do something like http://example:8084 and the space opened, but no matter what I do, I can't just use my domain

0
1 comment

Prerequisites:

  1. Space On-Premises (docker-compose) is installed on the host machine.

  2. The domain names for the Space services already exist and are being resolved to the IP address of the host machine. E.g. space.example.com, git.example.com, packages.example.com.

  3. Corresponding TLS certificates are acquired. Let's Encrypt would be the easiest way to acquire the certificate (https://letsencrypt.org/getting-started/).

  4. NGINX is installed on the host machine. Refer to the official guide for the installation details (https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/).

 

Installation:

  1. Create a custom NGINX configuration file in /etc/nginx/conf.d directory (e.g. space.conf). Below is a minimal example:

server {
    client_max_body_size 0;
    server_name space.example.com;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass http://127.0.0.1:8084/;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    listen 443 ssl;
    ssl_certificate /path_to_certs/space.example.com/fullchain.pem;
    ssl_certificate_key /path_to_certs/space.example.com/privkey.pem;
}

server {
    client_max_body_size 0;
    server_name git.example.com;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass http://127.0.0.1:8080/;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    listen 443 ssl;
    ssl_certificate /path_to_certs/git.example.com/fullchain.pem;
    ssl_certificate_key /path_to_certs/git.example.com/privkey.pem;
}

server {
    client_max_body_size 0;
    server_name packages.example.com;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass http://127.0.0.1:8390/;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
 
    listen 443 ssl;
    ssl_certificate /path_to_certs/packages.example.com/fullchain.pem;
    ssl_certificate_key /path_to_certs/packages.example.com/privkey.pem;
}

// configuring HTTP redirects

server {
    if ($host = space.example.com) {
        return 301 https://$host$request_uri;
    }

    server_name space.example.com;
    listen 80;
    return 404;
}

server {
    if ($host = git.example.com) {
        return 301 https://$host$request_uri;
    }

    server_name git.example.com;
    listen 80;
    return 404;
}

server {
    if ($host = packages.example.com) {
        return 301 https://$host$request_uri;
    }

    server_name packages.example.com;
    listen 80;
    return 404;
}

 

  1. In the space.conf file change server_name from space.example.com, git.example.com, and packages.example.com to the real Space domain names.

  2. In the space.conf file change ssl_certificate and ssl_certificate_key paths to the real ones.

  3. Save changes and apply the new config with the nginx -s reload command.

  4. (in case not done yet) Generate Space configuration files (https://www.jetbrains.com/help/space/docker-compose-installation.html#customize-space-service-configuration)

  5. Replace all external URLs with the HTTPS ones as it's described in the guide (https://www.jetbrains.com/help/space/docker-compose-installation.html#change-base-space-urls).

  6. Apply changes and restart Space installation.

2

Please sign in to leave a comment.