ci: add nginx configuration

This commit is contained in:
log101 2024-06-09 13:39:22 +03:00
parent 0fe7140380
commit e892cf2abd
5 changed files with 53 additions and 19 deletions

View File

@ -22,7 +22,7 @@ FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html COPY --from=builder /app/dist /usr/share/nginx/html
# Copy custom nginx configuration file if needed # Copy custom nginx configuration file if needed
# COPY nginx.conf /etc/nginx/nginx.conf COPY default.conf /etc/nginx/conf.d/default.conf
# Expose port 80 to the outside world # Expose port 80 to the outside world
EXPOSE 80 EXPOSE 80

44
default.conf Normal file
View File

@ -0,0 +1,44 @@
server {
listen 47543;
server_name blog.github.dev;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

View File

@ -1,8 +0,0 @@
version: "3.8"
services:
astro:
image: registry.log101.dev/astro-nginx:latest
ports:
- "47543:80"
restart: unless-stopped

View File

@ -1,5 +1,5 @@
--- ---
const base = import.meta.env.BASE_URL;
--- ---
<style> <style>
@ -26,7 +26,7 @@ const base = import.meta.env.BASE_URL;
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<div class="flex flex-row gap-2 items-center md:h-20 h-16"> <div class="flex flex-row gap-2 items-center md:h-20 h-16">
<a href={base} class="no-underline text-inherit" <a href="/" class="no-underline text-inherit"
><h1 class="font-mono md:text-6xl text-5xl -ml-[0.27rem]">Log101</h1></a ><h1 class="font-mono md:text-6xl text-5xl -ml-[0.27rem]">Log101</h1></a
> >
<div id="board" class="board"></div> <div id="board" class="board"></div>
@ -36,16 +36,16 @@ const base = import.meta.env.BASE_URL;
class="flex md:flex-row flex-col md:items-center justify-between list-none p-0 gap-3 nav-links" class="flex md:flex-row flex-col md:items-center justify-between list-none p-0 gap-3 nav-links"
> >
<li> <li>
<a href={`${base}/category/fikir`}>Fikir</a> <a href="/category/fikir">Fikir</a>
</li> </li>
<li> <li>
<a href={`${base}/category/teknik`}>Teknik</a> <a href="/category/teknik">Teknik</a>
</li> </li>
<li> <li>
<a href={`${base}/category/edebiyat`}>Babür'ün Serüvenleri</a> <a href="/category/edebiyat">Babür'ün Serüvenleri</a>
</li> </li>
<li> <li>
<a href={`${base}/category/ansiklopedi`}>Ansiklopedi</a> <a href="/category/ansiklopedi">Ansiklopedi</a>
</li> </li>
</ul> </ul>
<hr class="mb-0 mt-2" /> <hr class="mb-0 mt-2" />

View File

@ -33,9 +33,7 @@ const postDateFormatted = post.data.date.toLocaleDateString("tr-TR", {
year: "numeric", year: "numeric",
}); });
const base = import.meta.env.BASE_URL; const postLink = `/category/${post.data.category}/${post.slug}`;
const postLink = `${base}/category/${post.data.category}/${post.slug}`;
const { Content } = await post.render(); const { Content } = await post.render();
--- ---
@ -107,7 +105,7 @@ const { Content } = await post.render();
{post.body.length > 500 && ( {post.body.length > 500 && (
<a <a
class="text-inherit text-sm" class="text-inherit text-sm"
href={`${base}/category/${post.data.category}/${post.slug}`} href={`/category/${post.data.category}/${post.slug}`}
> >
Devamını Oku Devamını Oku
</a> </a>