32 Website hosting
Anthony Wang edited this page 2024-07-07 00:16:50 +00:00

We have free static and dynamic website hosting. If you made a cool website, please tell our community about it on Matrix! Also, let us know if you'd like it to be added to the community websites list or tracked by the status page (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!

Bonus: To check that you didn't make any syntax errors in your website, put its link into the W3C Markup Validation Service.

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,unlink-early 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>,mode=660,fork,unlink-early 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.

Please don't run a website with open registration, since moderation will be a huge pain. To integrate your site with exozyme's authentication system, see the Authentication page.

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.

Custom domains

If you would like to use a custom domain for your website, 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. 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.