summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--compose.yml4
-rwxr-xr-xdeploy.sh4
-rw-r--r--nginx.conf60
4 files changed, 30 insertions, 40 deletions
diff --git a/.gitignore b/.gitignore
index 27451f2..0e5e913 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
/public/
/.quarto/
+
+**/*.quarto_ipynb
diff --git a/compose.yml b/compose.yml
index b884097..60536f4 100644
--- a/compose.yml
+++ b/compose.yml
@@ -6,10 +6,12 @@ services:
ports:
- "8080:80"
volumes:
- - ./:/usr/share/nginx/html:ro
+ # Mount ONLY the public folder to the Nginx root
+ - ./public:/usr/share/nginx/html:ro
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
networks:
- nginx_default
+
networks:
nginx_default:
external: true
diff --git a/deploy.sh b/deploy.sh
index 991dd6d..6f6f6de 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -18,3 +18,7 @@ find . -name "*.qmd" -not -path "./.*" -not -path "./public/*" | while read -r f
# Render to plain text directly into the correct public sub-directory
quarto render "$file" --to plain --output "${base_name}.txt" --output-dir "public/$rel_dir"
done
+
+echo "Pushing to vps"
+
+rsync -avz --delete public/ jayrup.me:~/homepage/public/
diff --git a/nginx.conf b/nginx.conf
index cf4b30e..1eaadc9 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -1,48 +1,30 @@
+map $http_user_agent $format_suffix {
+ "~*curl" ".txt";
+ "~*wget" ".txt";
+ default "";
+}
+
+# Also check for Accept: text/plain
+map $http_accept $final_suffix {
+ "~*text/plain" ".txt";
+ default $format_suffix;
+}
+
server {
listen 80;
server_name jayrup.me;
-
root /usr/share/nginx/html;
- index index.html;
-
- # Helper variable: detect text clients
- set $want_text 0;
-
- if ($http_user_agent ~* "(curl|wget)") {
- set $want_text 1;
- }
- if ($http_accept ~* "text/plain") {
- set $want_text 1;
+ location / {
+ # This handles:
+ # 1. /cv -> /cv.txt (for curl)
+ # 2. /cv -> /cv.html (for browser)
+ # 3. /projects/ -> /projects/index.txt (for curl)
+ try_files $uri$final_suffix $uri.html $uri/index$final_suffix $uri/index.html =404;
}
- # Home
- location = / {
- if ($want_text) {
- rewrite ^ /index.txt break;
- }
- try_files /index.html =404;
- }
-
- # Projects
- location = /projects {
- if ($want_text) {
- rewrite ^ /projects.txt break;
- }
- try_files /projects.html =404;
- }
-
- # CV
- location = /cv {
- if ($want_text) {
- rewrite ^ /cv.txt break;
- }
- try_files /cv.html =404;
- }
-
- # Force correct type for text files
- location ~ \.txt$ {
- default_type text/plain;
+ # Ensure text files are served correctly
+ location ~* \.txt$ {
+ add_header Content-Type text/plain;
}
}
-