<?= VV::include("modules/snippet/Snippet.php") ?>
<section class="md">
	<container>
		<h1>Installation</h1>
		<p>In this guide we will be installing Vegvisir on a Debian-based system with NGINX as the web server. The process should be similar for other configurations as well.</p>
		<p><a href="/help">Please contact me if you need help</a></p>
	</container>
</section>
<section class="md">
	<container>
		<h2>Prerequisites</h2>
		<ul>
			<li>PHP 8.0 or newer (PHP 8.3 is recommended)</li>
			<li>A web server (NGINX is used in this guide)</li>
		</ul>
	</container>
</section>
<section class="md">
	<container>
		<h2>Step 1: Clone the repo</h2>
		<p>Let's start by cloning Vegvisir to a folder. The code for Vegvisir will be separate from the code for your project.</p>
		<?= Snippet::put("docs/installation/0", Snippet::PLAINTEXT) ?>
		<p>I have cloned this into the folder <code>/var/www/vegvisir</code> but you can put it wherever you want.</p>
	</container>
</section>
<section class="md">
	<container>
		<h2>Step 2: Install dependencies</h2>
		<p>Vegvisir only has one dependency, let's <code>cd</code> into our folder and install it with <a href="https://getcomposer.org/" target="_blank">Composer</a>.</p>
		<?= Snippet::put("docs/installation/1", Snippet::PLAINTEXT) ?>
	</container>
</section>
<section class="md">
	<container>
		<h2>Step 3: Configure virtual host</h2>
		<p>We will be pointing a virtual host to the <code>/public/index.php</code> file from the Vegvisir root directory.</p>
		<p>Since your project files will live in a different directory, this can be set-and-forget.</p>
		<?= Snippet::put("docs/installation/2", Snippet::PLAINTEXT) ?>
	</container>
</section>
<section class="md">
	<container>
		<h2>Step 4: Create project folder</h2>
		<p>We're almost done here. We want to create a separate folder which will hold our project files.</p>
		<p>Let's create a folder <code>/var/www/my-website</code> as an example - you can put this wherever you want!</p>
		<?= Snippet::put("docs/installation/3", Snippet::PLAINTEXT) ?>
	</container>
</section>
<section class="md">
	<container>
		<h2>Step 5: Point Vegvisir to project folder</h2>
		<p>Now let's finish up by pointing Vegvisir to the folder we just created.</p>
		<p>Make a copy of the <code>.env.example.ini</code> file from Vegvisir's root directory and place it in the same spot as <code>.env.ini</code></p>
		<?= Snippet::put("docs/installation/4", Snippet::PLAINTEXT) ?>
	</container>
</section>
<section class="md">
	<container>
		<p>There is only one line we need to change inside the <code>.env.ini</code> file we just created. It should be the top most variable called <code>root_path</code>.</p>
		<p>Change the value of this variable to an absolute path to your project <strong>root</strong> folder. In our case it will be <code>/var/www/my-website</code>.</p>
		<?= Snippet::put("docs/installation/5", Snippet::PLAINTEXT) ?>
	</container>
</section>
<section class="md">
	<container>
		<h2>Done!</h2>
		<p>That's all there is to it. Restart your webserver if you haven't and navigate to your published website.</p>
		<p>If everything worked correctly, you should see a default landing page with a summary.</p>
	</container>
</section>
<hr>
<section class="md">
	<container>
		<h1>Static assets</h1>
		<p>Vegvisir will automatically serve anything that isn't a <code>.php</code> file under <code>/public</code> in your project directory as a static asset. You can for example put your <code>robots.txt</code> file under <code>/public/robots.txt</code> and it will be returned as a <code>text/plain</code> document.</p>
		<p>While this works fine for smaller assets, they still have to be passed through the PHP CGI. This process is a bit slower than serving assets with your web server directly - and might be a lot slower for larger files.</p>
		<p>To fix this, let's add an optional <code>location</code> block to our NGINX configuration which will handle assets. The process should be similar for other web servers - <a href="/help">contact me if you need help</a>.</p>
	</container>
</section>
<section class="md">
	<container>
		<p>Let's add the following <code>location</code> block to our NGINX virtual host that we set up in <a href="#asd">Step X</a>.</p>
	</container>
</section>
<?= VV::shell("shells/docs") ?>