]> BookStack Code Mirror - devops/commitdiff
Added nginx subpath proxy example config
authorDan Brown <redacted>
Fri, 28 Jan 2022 18:41:01 +0000 (18:41 +0000)
committerDan Brown <redacted>
Fri, 28 Jan 2022 18:41:01 +0000 (18:41 +0000)
Moved old ubuntu 16.04 config so better align structure with apache
configs and so we can add more nginx confix examples as required.

config/nginx/subpath-proxy-config [new file with mode: 0644]
config/nginx/ubuntu-1604-install-config [moved from config/nginx with 100% similarity]
scripts/installation-ubuntu-16.04.sh

diff --git a/config/nginx/subpath-proxy-config b/config/nginx/subpath-proxy-config
new file mode 100644 (file)
index 0000000..b64fdb6
--- /dev/null
@@ -0,0 +1,53 @@
+# This example nginx config file shows a method of hosting BookStack on a 
+# URL sub path (http://example.com/bookstack). There are many ways to achieve
+# this but the below method uses a reverse proxy style method to keep the BookStack
+# configuration contained within it's own server block.
+
+# There are two server blocks in this file.
+# The first is pointed at BookStack so has the PHP config, but
+# this is only intended to be used locally (hence on port 8080 and using "localhost").
+# The "root" directory is pointed to the "public" folder within your BookStack 
+# install folder.
+
+# The second would represent your existing website (http://example.com in this case).
+# The "location /bookstack/" block will take web requests to `/bookstack/` and proxy 
+# them to the first internal-only server block. 
+
+# Note: The "root" of the first server block should not be a child directory of the 
+#       second server block. This would likely cause an insecure setup.
+
+server {
+  listen 8080;
+  listen [::]:8080;
+
+  server_name localhost;
+
+  root /var/www/bookstack/public;
+  index index.php index.html;
+
+  location / {
+    try_files $uri $uri/ /index.php?$query_string;
+  }
+  
+  location ~ \.php$ {
+    include snippets/fastcgi-php.conf;
+    fastcgi_pass unix:/run/php/php7.4-fpm.sock;
+  }
+}
+
+
+server {
+  listen 80;
+  listen [::]:80;
+
+  server_name example.com;
+
+  root /var/www/html;
+  index index.html;
+
+  location /bookstack/ {
+    proxy_pass http://localhost:8080/;
+    proxy_redirect off;
+  }
+  
+}
index 7de3b2edd78dac89fedd36e9f4c2348997470f49..c67babe976713627274875069e5246d223afb06d 100644 (file)
@@ -62,7 +62,7 @@ php artisan migrate --no-interaction --force
 chown www-data:www-data -R bootstrap/cache public/uploads storage && chmod -R 755 bootstrap/cache public/uploads storage
 
 # Add nginx configuration
-curl -s https://raw.githubusercontent.com/BookStackApp/devops/master/config/nginx > /etc/nginx/sites-available/bookstack
+curl -s https://raw.githubusercontent.com/BookStackApp/devops/master/config/nginx/ubuntu-1604-install-config > /etc/nginx/sites-available/bookstack
 sed -i.bak "s/bookstack.dev/$DOMAIN/" /etc/nginx/sites-available/bookstack
 ln -s /etc/nginx/sites-available/bookstack /etc/nginx/sites-enabled/bookstack