Host a website on the Pubnix: Difference between revisions

From Project Segfault Wiki
(Update info)
 
(fix image)
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File:ThePubnixServerFlowchart.png|thumb|A flowchart showing what happens when a user makes a request through your usersite. It's kind of a mess.]]
== The basics ==
== The basics ==


Line 4: Line 5:
So you have a website and you want to host it. Great! Let's get started.
So you have a website and you want to host it. Great! Let's get started.


First of all, we use Caddy for web server because of its simplicity. You can install any web server you want using [https://search.nixos.org the Nix package manager].  
First of all, we use Caddy for web server because of its simplicity. You can install any web server you want using [https://search.nixos.org the Nix package manager], however, you will receive no support from us when you go that path. Maybe you have experience with nginx, which is cool, but we use Caddy here.  


By default, we have a caddy server running with the configuration in ~/Caddyfile.
By default, we have a Caddy web server running with the configuration in ~/Caddyfile.


We also have a few QoL aliases such as rc (reload caddy), ft (format Caddyfile), vt (validate Caddyfile).
We also have a few QoL aliases such as rc (reload caddy), ft (format Caddyfile), vt (validate Caddyfile).


The caddyserver listens on `~/.webserver.sock`.
Your Caddy web server listens on `~/.webserver.sock`.


Any webserver you install needs to listen on `~/.webserver .sock`. Else it will not be recognized by the master caddyserver.
Any webserver you install needs to listen on `~/.webserver .sock`. If you don't, it will not be recognized by the master Caddy server.


The default caddy configuration checks ~/public_html for static files.
The default Caddy configuration checks ~/public_html for static files. It also has PHP capability out of the box, so you can run a PHP website if you want to do that. (PHP 8.2)
 
Additionally, it also supports PHP with a php8.2 FPM instance running on the pubnix.


Every user also gets access to *-username.p.projectsegfau.lt for hosting more applications.
Every user also gets access to *-username.p.projectsegfau.lt for hosting more applications.


For example, you can host your own webapp on mywebapp-username.p.projectsegfau.lt, while your main website is on username.projectsegfau.lt.
For example, you can host your own web app on mywebapp-username.p.projectsegfau.lt, while your main website is on username.p.projectsegfau.lt.


To create a new configuration for a subdomain, just append the following to the Caddyfile.<pre>
To create a new configuration for a subdomain, just append the following to the Caddyfile.<pre>

Revision as of 10:14, 4 March 2023

A flowchart showing what happens when a user makes a request through your usersite. It's kind of a mess.

The basics

So you have a website and you want to host it. Great! Let's get started.

First of all, we use Caddy for web server because of its simplicity. You can install any web server you want using the Nix package manager, however, you will receive no support from us when you go that path. Maybe you have experience with nginx, which is cool, but we use Caddy here.

By default, we have a Caddy web server running with the configuration in ~/Caddyfile.

We also have a few QoL aliases such as rc (reload caddy), ft (format Caddyfile), vt (validate Caddyfile).

Your Caddy web server listens on `~/.webserver.sock`.

Any webserver you install needs to listen on `~/.webserver .sock`. If you don't, it will not be recognized by the master Caddy server.

The default Caddy configuration checks ~/public_html for static files. It also has PHP capability out of the box, so you can run a PHP website if you want to do that. (PHP 8.2)

Every user also gets access to *-username.p.projectsegfau.lt for hosting more applications.

For example, you can host your own web app on mywebapp-username.p.projectsegfau.lt, while your main website is on username.p.projectsegfau.lt.

To create a new configuration for a subdomain, just append the following to the Caddyfile.

http://webapp-username.projectsegfau.lt {
    bind unix/.webserver.sock
    reverse_proxy localhost:port
}