You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h1class="post-title">Setup Raspberry Pi to serve a Laravel based website</h1>
39
+
<spanclass="post-date">06.02.2025</span>
40
+
<hr>
41
+
<divclass="post-content"><p>The official website of Laravel has already a <ahref="https://laravel.com/docs/11.x">documentation</a> on howto install it on a Linux OS, but it requires to trust the installer script. This would have been run directly on the local machine without prior checking the contents and what is really done.
42
+
Of course I manually checked the install script and did not like what I found. The installed elements would not be tracked by the package manager, it would install another certificate authority list for the local installation. Things I consider non-maintainable or unsafe. So I wanted to go another (more clean?) way on a Raspberry Pi.</p>
43
+
44
+
<ol>
45
+
<li>First I needed to install the necessary tools using the commandline.
46
+
<ul>
47
+
<li>I wanted to use <codeclass="language-plaintext highlighter-rouge">nginx</code> to serve the websites.</li>
48
+
<li>I wanted to use <codeclass="language-plaintext highlighter-rouge">php-fpm</code> because it is faster than the apache and/or cgi combinations. And of course because it runs on a Raspberry Pi.</li>
49
+
<li>I needed <codeclass="language-plaintext highlighter-rouge">composer</code> for php packages.</li>
<p>I then configured nginx to serve a new site by adding a file <codeclass="language-plaintext highlighter-rouge">/etc/nginx/sites-available/laravel-www</code>:</p>
<p>This already contains the necessary parts for serving on a HTTP server (no SSL here at the moment!) using the installed PHP version.
86
+
I used the version-free <codeclass="language-plaintext highlighter-rouge">php-fpm</code> symlink so updating/changing to another PHP version is easier later.</p>
87
+
</li>
88
+
<li>The site was then activated to be served already, as it was not public on the internet:
<li>For the installation to work, I needed to setup some access rights, as <codeclass="language-plaintext highlighter-rouge">nginx</code> is running as <codeclass="language-plaintext highlighter-rouge">www-data</code> user:
<li>For the Laravel project itself, my first start should used the <codeclass="language-plaintext highlighter-rouge">sqlite</code> database to just show that the laravel part is working. So I initialized it using the default configurations in the <codeclass="language-plaintext highlighter-rouge">/var/www/laravel-www/.env</code> file via:
Copy file name to clipboardExpand all lines: blog/index.html
+78-13Lines changed: 78 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,82 @@ <h1>Xargas.eu</h1>
36
36
<divclass="content">
37
37
<divclass="blog">
38
38
39
+
<divclass="blog-entry">
40
+
<h1class="blog-title"><ahref="/2025/02/06/laravelSetupOnPi.html">Setup Raspberry Pi to serve a Laravel based website</a></h1>
41
+
<spanclass="blog-date">06.02.2025</span>
42
+
<hr>
43
+
<divclass="blog-content"><p>The official website of Laravel has already a <ahref="https://laravel.com/docs/11.x">documentation</a> on howto install it on a Linux OS, but it requires to trust the installer script. This would have been run directly on the local machine without prior checking the contents and what is really done.
44
+
Of course I manually checked the install script and did not like what I found. The installed elements would not be tracked by the package manager, it would install another certificate authority list for the local installation. Things I consider non-maintainable or unsafe. So I wanted to go another (more clean?) way on a Raspberry Pi.</p>
45
+
46
+
<ol>
47
+
<li>First I needed to install the necessary tools using the commandline.
48
+
<ul>
49
+
<li>I wanted to use <codeclass="language-plaintext highlighter-rouge">nginx</code> to serve the websites.</li>
50
+
<li>I wanted to use <codeclass="language-plaintext highlighter-rouge">php-fpm</code> because it is faster than the apache and/or cgi combinations. And of course because it runs on a Raspberry Pi.</li>
51
+
<li>I needed <codeclass="language-plaintext highlighter-rouge">composer</code> for php packages.</li>
<p>I then configured nginx to serve a new site by adding a file <codeclass="language-plaintext highlighter-rouge">/etc/nginx/sites-available/laravel-www</code>:</p>
<p>This already contains the necessary parts for serving on a HTTP server (no SSL here at the moment!) using the installed PHP version.
88
+
I used the version-free <codeclass="language-plaintext highlighter-rouge">php-fpm</code> symlink so updating/changing to another PHP version is easier later.</p>
89
+
</li>
90
+
<li>The site was then activated to be served already, as it was not public on the internet:
<li>For the installation to work, I needed to setup some access rights, as <codeclass="language-plaintext highlighter-rouge">nginx</code> is running as <codeclass="language-plaintext highlighter-rouge">www-data</code> user:
<li>For the Laravel project itself, my first start should used the <codeclass="language-plaintext highlighter-rouge">sqlite</code> database to just show that the laravel part is working. So I initialized it using the default configurations in the <codeclass="language-plaintext highlighter-rouge">/var/www/laravel-www/.env</code> file via:
<divclass="blog-content"><p>This is a private website, where I document my hobbies. The reason why I started this website is that I often find hints, tips or clues, but I rarely find “complete information”. And of course, I also want to later find that info myself again.</p>
166
-
167
-
<p>So in case you have similar interests you could find something here!</p>
<divclass="blog-content"><p>This is a private website, where I document my hobbies. The reason why I started this website is that I often find hints, tips or clues, but I rarely find “complete information”. And of course, I also want to later find that info myself again.</p>
44
+
45
+
<p>So in case you have similar interests you could find something here!</p>
0 commit comments