28 Website hosting
Anthony Wang edited this page 2024-03-19 11:31:36 -04:00

exozyme offers free static and dynamic website hosting. If you made a cool website and would like to add it to the exozyme-hosted community websites list, just send a message on Matrix or make a PR to this repo. Please specify if you would like your website to be tracked by the status page, and if so, specify a link that doesn't send outbound requests because external services are flaky.

Static hosting

Greetings, exozyme user! So you want to create a nice, clean website, but are poor and pathetic? Lucky for you, exozyme has got all you need!

1. Settling on a name

Ideally, you want a name that will stand out. I usually go with my username, like 2kwatts.exozy.me, but if you're making it for a project, you can use that instead. (You have unlimited choices!)

2. The back-end basics

SSH into exozyme, then travel over to /srv/http. After that, make a directory. Title it the name you decided in the previous section, as long as it's not taken. Once that's done, enter it and run touch index.html. This will create the main page for your website. So when people travel there, they will see this file by default.

3. Writing the website stuff

Using your favorite text editor, open up the file. Assuming you have some basic HTML knowledge, you should know what to do here. Once you're done writing mindless code for now, save and quit the file. Now open your site in a web browser. It will be something like your foldername.exozy.me.

Now, thanks to exozyme and @megawatts, you have your own Internet place where you can do whatever you want!

TL;DR: If you create a directory with files for your static website at /srv/http/subdomain, the website will be available at subdomain.exozy.me.

Dynamic hosting

To host a dynamic website at https://subdomain.exozy.me, create a Unix socket called /srv/http/subdomain with permissions 660. If your website only supports binding to a TCP port but you would like it to bind to a Unix socket, you can use socat UNIX-LISTEN:/srv/http/subdomain,mode=660,fork TCP:localhost:1234. This proxies all requests to https://subdomain.exozy.me to your website hosted on port 1234. To run your website automatically, you should write a systemd user service. If you need a more complex web server configuration than just simply proxying a port, you can submit a pull request to our nginx config file repository.

If you're using podman-compose to run containers, you can use this workaround expose a port to a unix socket:

  tcptosocket:
    image: docker.io/alpine/socat:latest
    environment:
    command: "UNIX-LISTEN:/mnt/<SERVICE_NAME>,fork,mode=660 TCP4:<CONTAINER_NAME_TO_FOWARD>:<CONTAINER_PORT>"
    volumes:
      - /srv/http:/mnt

This uses an Alpine container with socat installed, and creates the socket in the /srv/http directory.

CGI scripts

Our nginx server does not have CGI enabled for security reasons. If you would like to run CGI scripts, then you should run your own HTTP server with CGI support such as python -m http.server --cgi (only useful for testing), mini_httpd, or caddy-cgi.

Sub-subdomains and custom domains

If you would like to use a sub-subdomain (for instance blog.user.exozy.me) or a custom domain for your website, you will have to fork our nginx configs repo and write a short config file for your website. See the configs for karawale.in or neovoid.is-cool.dev for examples. For custom domains, you also need to add a CNAME, ANAME, or ALIAS record in your DNS settings to point your custom domain to exozy.me. Make sure you point your domain to exozy.me and not our IP address, since our IP address changes occasionally. exozyme will handle generating and renewing the TLS certificate.