1"use strict";(globalThis.webpackChunkbacula_web=globalThis.webpackChunkbacula_web||[]).push([[5483],{14858(e,n,i){i.r(n),i.d(n,{assets:()=>o,contentTitle:()=>l,default:()=>h,frontMatter:()=>t,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"install/web-server/nginx","title":"Nginx","description":"Follow instructions below to set up Bacula-Web with Nginx instead of Apache www.","source":"@site/docs/install/web-server/nginx.md","sourceDirName":"install/web-server","slug":"/install/web-server/nginx","permalink":"/docs/install/web-server/nginx","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"customSidebar","previous":{"title":"Apache","permalink":"/docs/install/web-server/apache"},"next":{"title":"Lighttpd","permalink":"/docs/install/web-server/lighttpd"}}');var r=i(74848),a=i(28453);const t={},l="Nginx",o={},c=[{value:"Install nginx & PHP-FPM",id:"install-nginx--php-fpm",level:2},{value:"Configure PHP-FPM",id:"configure-php-fpm",level:2},{value:"Configure Nginx",id:"configure-nginx",level:2}];function d(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"nginx",children:"Nginx"})}),"\n",(0,r.jsxs)(n.p,{children:["Follow instructions below to set up Bacula-Web with ",(0,r.jsx)(n.a,{href:"https://nginx.org/en/",children:"Nginx"})," instead of ",(0,r.jsx)(n.a,{href:"https://httpd.apache.org/",children:"Apache www"}),"."]}),"\n",(0,r.jsxs)(n.admonition,{type:"info",children:[(0,r.jsxs)(n.p,{children:["Following instructions are for ",(0,r.jsx)(n.a,{href:"https://www.releases.ubuntu.com/noble/",children:"Ubuntu 24.04 (Noble Numbat)"}),"."]}),(0,r.jsx)(n.p,{children:"If you are using another Debian distribution, you may need to adapt some paths and/or the name of package(s)."})]}),"\n",(0,r.jsx)(n.h2,{id:"install-nginx--php-fpm",children:"Install nginx & PHP-FPM"}),"\n",(0,r.jsx)(n.p,{children:"Download latest package lists"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"$ sudo apt-get update\n"})}),"\n",(0,r.jsx)(n.p,{children:"Install Nginx and PHP-FPM"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"$ sudo apt-get install nginx php-fpm\n"})}),"\n",(0,r.jsx)(n.h2,{id:"configure-php-fpm",children:"Configure PHP-FPM"}),"\n",(0,r.jsx)(n.p,{children:"Modify PHP-FPM configuration"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"$ sudo vim /etc/php/8.3/fpm/php.ini\n \ncgi.fix_pathinfo=0\ndate.timezeone = Europe/Zurich\n"})}),"\n",(0,r.jsx)(n.p,{children:"Restart PHP-FPM service"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"$ sudo systemctl php8.3-fpm restart\n"})}),"\n",(0,r.jsx)(n.h2,{id:"configure-nginx",children:"Configure Nginx"}),"\n",(0,r.jsx)(n.p,{children:"Define a new virtual server configuration like below."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-nginx",children:"server {\n listen 80;\n server_name bacula-web.domain.com;\n index index.php;\n\n error_log /var/log/nginx/bacula-web.error.log;\n access_log /var/log/nginx/bacula-web.access.log;\n\n root /var/www/bacula-web/public;\n\n location / {\n try_files $uri /index.php$is_args$args;\n }\n\n location ~ \\.php {\n try_files $uri =404;\n fastcgi_split_path_info ^(.+\\.php)(/.+)$;
1\n include fastcgi_params;\n fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n fastcgi_param SCRIPT_NAME $fastcgi_script_name;\n fastcgi_index index.php;\n fastcgi_pass 127.0.0.1:9123;\n }\n}\n"})}),"\n",(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsxs)(n.p,{children:["Since v8.6.0, the ",(0,r.jsx)(n.strong,{children:"root"})," path must be set to the ",(0,r.jsx)(n.code,{children:"public"})," subdirectory."]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-nginx",metastring:'title="prior v8.6.0"',children:"root /var/www/bacula-web;\n"})}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-nginx",metastring:'title="using v8.6.0 and above"',children:"root /var/www/bacula-web/public;\n"})})]}),"\n",(0,r.jsx)(n.p,{children:"Test your configuration"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:'$ sudo nginx -t && echo "Nginx is ok"\n'})}),"\n",(0,r.jsx)(n.p,{children:"Restart Nginx to apply configuration changes"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"$ sudo systemctl restart nginx\n"})}),"\n",(0,r.jsx)(n.p,{children:"You can now proceed with any of the installation method below"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/docs/install/archive-install",children:"Using the archive"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/docs/install/composer-install",children:"Using Composer"})}),"\n"]}),"\n",(0,r.jsx)(n.admonition,{title:"Running in a subdirectory",type:"tip",children:(0,r.jsxs)(n.p,{children:["If you would like to setup Bacula-Web on a shared web server, please follow the instructions from the ",(0,r.jsx)(n.a,{href:"/docs/install/web-server/shared-web-server",children:"shared web server"})," page."]})})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},28453(e,n,i){i.d(n,{R:()=>t,x:()=>l});var s=i(96540);const r={},a=s.createContext(r);function t(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:t(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.