{"id":2239,"date":"2017-07-22T14:15:57","date_gmt":"2017-07-22T13:15:57","guid":{"rendered":"https:\/\/denbeke.be\/blog\/?p=2239"},"modified":"2017-07-22T14:17:41","modified_gmt":"2017-07-22T13:17:41","slug":"serving-self-hosted-invoice-ninja-with-caddy-and-php-fpm","status":"publish","type":"post","link":"https:\/\/denbeke.be\/blog\/software\/serving-self-hosted-invoice-ninja-with-caddy-and-php-fpm\/","title":{"rendered":"Serving self-hosted Invoice Ninja with Caddy"},"content":{"rendered":"<p><a href=\"https:\/\/www.invoiceninja.com\" target=\"_blank\"><img loading=\"lazy\" class=\"alignright size-medium wp-image-2243\" src=\"https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2017\/07\/Invoice-Ninja-logo-300x187.png\" alt=\"Invoice Ninja logo\" width=\"300\" height=\"187\" srcset=\"https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2017\/07\/Invoice-Ninja-logo-300x187.png 300w, https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2017\/07\/Invoice-Ninja-logo.png 504w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>Invoice Ninja<\/a> is an open-source platform which helps you take care of clients, invoices, payments, expenses, time-tracking, and more&#8230;<br \/>\nIn this guide I explain how you can run Invoice Ninja on your own server with <a href=\"https:\/\/caddyserver.com\" target=\"_blank\">Caddy<\/a> and PHP-FPM.<\/p>\n<h3 id=\"prerequisites\">Prerequisites<\/h3>\n<ul>\n<li>MySQL Server up and running<\/li>\n<li>PHP-FPM up and running<\/li>\n<li>I assume that you have already setup Caddy and know it&#8217;s basics. I have other guides if you need help running Caddy with <a href=\"https:\/\/denbeke.be\/blog\/servers\/running-caddy-server-as-a-service-with-systemd\/\" target=\"_blank\">systemd<\/a> or <a href=\"https:\/\/denbeke.be\/blog\/servers\/running-caddy-server-as-a-service\/\" target=\"_blank\">upstart<\/a>.<\/li>\n<\/ul>\n<h3 id=\"download-the-latest-version-of-invoice-ninja\">Download the latest version of Invoice Ninja<\/h3>\n<p>Download the latest version here: <a href=\"https:\/\/download.invoiceninja.com\/\">Download Invoice Ninja<\/a>.<\/p>\n<h3 id=\"setup-the-database\">Setup the database<\/h3>\n<p>Open the MySQL console:<\/p>\n<pre><code>$ mysql -u root -p<\/code><\/pre>\n<p>Execute the following SQL statements to create the database for Invoice Ninja, and grant a new user access to it:<\/p>\n<pre class=\"sql\"><code>CREATE DATABASE ninja;\r\nCREATE USER 'ninja'@'localhost' IDENTIFIED BY 'ninja';\r\nGRANT ALL PRIVILEGES ON ninja.* TO 'ninja'@'localhost';<\/code><\/pre>\n<h3 id=\"caddyfile\">Caddyfile<\/h3>\n<p>I use the following Caddyfile for Invoice Ninja:<\/p>\n<pre><code>invoiceninja.domain.com {\r\n    root sites\/invoiceninja\/public\r\n    fastcgi \/ unix:\/var\/run\/php\/php7.0-fpm.sock php\r\n    log sites\/invoiceninja\/access.log\r\n    errors sites\/invoiceninja\/error.log\r\n    \r\n    \/\/ Rewrite rules for Invoice Ninja (Laravel)\r\n    rewrite {\r\n        r .*\r\n        ext \/\r\n        to \/index.php?{query}\r\n    }\r\n}<\/code><\/pre>\n<p><code>invoiceninja.domain.com<\/code> will automatically be served over HTTPS.<\/p>\n<h3 id=\"installing-invoice-ninja\">Installing Invoice Ninja<\/h3>\n<p>Installing Invoice Ninja is then straightforward: point your browser to <code>invoiceninja.domain.com<\/code>, and follow the on-screen steps.<br \/>\nI used Sendgrid as email provider, but you can also use your local mail server or any email service.<\/p>\n<figure style=\"width: 764px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" class=\"size-full wp-image-2245\" src=\"https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2017\/07\/Invoice-Ninja-setup-database-and-general.png\" alt=\"Invoice Ninja setup (database and general)\" width=\"764\" height=\"707\" srcset=\"https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2017\/07\/Invoice-Ninja-setup-database-and-general.png 764w, https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2017\/07\/Invoice-Ninja-setup-database-and-general-300x278.png 300w\" sizes=\"(max-width: 764px) 100vw, 764px\" \/><figcaption class=\"wp-caption-text\">Invoice Ninja installation wizard.<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Invoice Ninja is an open-source platform which helps you take care of clients, invoices, payments, expenses, time-tracking, and more&#8230; In this guide I explain how you can run Invoice Ninja on your own server with Caddy and PHP-FPM. Prerequisites MySQL Server up and running PHP-FPM up and running I assume that you have already setup [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[227,161],"tags":[260,240,151,215,186,110],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.6.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Serving self-hosted Invoice Ninja with Caddy &ndash; DenBeke<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/denbeke.be\/blog\/software\/serving-self-hosted-invoice-ninja-with-caddy-and-php-fpm\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Serving self-hosted Invoice Ninja with Caddy &ndash; DenBeke\" \/>\n<meta property=\"og:description\" content=\"Invoice Ninja is an open-source platform which helps you take care of clients, invoices, payments, expenses, time-tracking, and more&#8230; In this guide I explain how you can run Invoice Ninja on your own server with Caddy and PHP-FPM. Prerequisites MySQL Server up and running PHP-FPM up and running I assume that you have already setup [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/denbeke.be\/blog\/software\/serving-self-hosted-invoice-ninja-with-caddy-and-php-fpm\/\" \/>\n<meta property=\"og:site_name\" content=\"DenBeke\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-22T13:15:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-07-22T13:17:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2017\/07\/Invoice-Ninja-logo-300x187.png\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:creator\" content=\"@MthsBk\" \/>\n<meta name=\"twitter:site\" content=\"@MthsBk\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"1 minute\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/denbeke.be\/blog\/#website\",\"url\":\"https:\/\/denbeke.be\/blog\/\",\"name\":\"DenBeke\",\"description\":\"Mathias Beke\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/denbeke.be\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/denbeke.be\/blog\/software\/serving-self-hosted-invoice-ninja-with-caddy-and-php-fpm\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2017\/07\/Invoice-Ninja-logo.png\",\"width\":504,\"height\":314,\"caption\":\"Invoice Ninja logo\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/denbeke.be\/blog\/software\/serving-self-hosted-invoice-ninja-with-caddy-and-php-fpm\/#webpage\",\"url\":\"https:\/\/denbeke.be\/blog\/software\/serving-self-hosted-invoice-ninja-with-caddy-and-php-fpm\/\",\"name\":\"Serving self-hosted Invoice Ninja with Caddy &ndash; DenBeke\",\"isPartOf\":{\"@id\":\"https:\/\/denbeke.be\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/denbeke.be\/blog\/software\/serving-self-hosted-invoice-ninja-with-caddy-and-php-fpm\/#primaryimage\"},\"datePublished\":\"2017-07-22T13:15:57+00:00\",\"dateModified\":\"2017-07-22T13:17:41+00:00\",\"author\":{\"@id\":\"https:\/\/denbeke.be\/blog\/#\/schema\/person\/386878f712fe3fe22227216f087772dc\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/denbeke.be\/blog\/software\/serving-self-hosted-invoice-ninja-with-caddy-and-php-fpm\/\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/denbeke.be\/blog\/#\/schema\/person\/386878f712fe3fe22227216f087772dc\",\"name\":\"Mathias Beke\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/denbeke.be\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/015ba35e6ce4f5859e3888ca99807575?s=96&d=mm&r=g\",\"caption\":\"Mathias Beke\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts\/2239"}],"collection":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/comments?post=2239"}],"version-history":[{"count":7,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts\/2239\/revisions"}],"predecessor-version":[{"id":2248,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts\/2239\/revisions\/2248"}],"wp:attachment":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/media?parent=2239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/categories?post=2239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/tags?post=2239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}