Skip to content

Commit 090a676

Browse files
authored
Fix double content
Removed content since it's double content with https://invoiceninja.github.io/en/self-host-installation/ while this page doesn't seem linked anywhere on https://invoiceninja.github.io. Signed-off-by: dros <[email protected]>
1 parent 0c13462 commit 090a676

File tree

1 file changed

+2
-336
lines changed

1 file changed

+2
-336
lines changed

source/en/self-host.md

Lines changed: 2 additions & 336 deletions
Original file line numberDiff line numberDiff line change
@@ -4,340 +4,6 @@ section: content
44
locale: en
55
---
66

7-
# Self Host
7+
# Location Change
88

9-
## Server Requirements
10-
11-
<p>Invoice Ninja has a few system requirements. Built on top of <a href="https://www.laravel.com/docs/">Laravel</a> it requires a PHP and MySQL server at a minimum with the following version and extensions installed.</p>
12-
13-
<x-warning>
14-
You need to setup this version completely from scratch. Do not attempt to overwrite your old version of Invoice Ninja (4.x.x) with this version as the two codebases are completely different.
15-
</x-warning>
16-
17-
* PHP 8.2 with following extensions
18-
* bcmath
19-
* ctype
20-
* fileinfo
21-
* gd
22-
* mbstring
23-
* openssl
24-
* PDO
25-
* tokenizer
26-
* xml
27-
* curl
28-
* zip
29-
* gmp
30-
* iconv
31-
* mysqli
32-
* fpm (if using NGINX)
33-
* MySQL 5.7+ or MariaDB 10.3+
34-
* NGINX or Apache
35-
36-
On ubuntu this should be as simple as running:
37-
38-
```bash
39-
sudo apt install php8.2-bcmath php8.2-gmp php8.2-fileinfo \
40-
php8.2-gd php8.2-mbstring php8.2-pdo php8.2-xml \
41-
php8.2-curl php8.2-zip php8.2-gmp php8.2-mysql php8.2-fpm
42-
```
43-
44-
## Installing Invoice Ninja
45-
46-
### Ubuntu 20.04 (Recommended)
47-
48-
Community member TechnicallyComputers has a very helpful step by step guide on how to install Invoice Ninja v5 from scratch onto Ubuntu, you can access the guide [here](https://forum.invoiceninja.com/t/install-invoice-ninja-v5-5-on-ubuntu-22-04/13272)
49-
50-
### Installing on CentOS 8
51-
52-
If CentOS is more your Flavour, community member TechnicallyComputers has a very thorough step by step installation guide [here](https://forum.invoiceninja.com/t/install-invoice-ninja-v5-on-centos-8/4293).
53-
54-
### Installing on Arch
55-
56-
If Arch Linux is more your flavour, community member brackenhill-mob has a very thorough step by step installation guide [here](https://forum.invoiceninja.com/t/howto-install-invoice-ninja-v5-on-arch-linux/6196)
57-
58-
### Installing on Enterprise Linux
59-
60-
TechnicallyComputers also has a guide for installation Invoice Ninja on Enterprise Linux [here](https://forum.invoiceninja.com/t/install-invoice-ninja-v5-on-enterprise-linux-8/4293)
61-
62-
### Installing using Docker
63-
64-
We have a dedicated repository with detailed instructions on how to get started <a href="https://github.com/invoiceninja/dockerfiles">HERE</a>.
65-
66-
<iframe width="560" height="315" src="https://www.youtube.com/embed/xo6a3KtLC2g" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
67-
68-
### Download pre built tar. (Advanced)
69-
70-
<iframe width="560" height="315" src="https://www.youtube.com/embed/i04EX7WXTVE" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
71-
72-
<p>A prebuilt tar can be downloaded from our GitHub release page <a href="https://github.com/invoiceninja/invoiceninja/releases">here</a>. You will need to download the package named <b>invoiceninja.tar</b></p>
73-
74-
<p>Untar this file into the virtual host directory you have created.</p>
75-
76-
#### File Permissions
77-
78-
<x-warning>
79-
Ensure the file permission have been set to the web server user. For example in Ubuntu this is www-data if you have configured a virtual host with a root directory of `/var/www/html` you would set the ownership like this.
80-
</x-warning>
81-
82-
```bash
83-
sudo chown -R www-data:www-data /var/www/html
84-
sudo find ./ -type d -exec chmod 755 {} \;
85-
```
86-
87-
##### Web server configuration
88-
<p>A sample NGINX configuration is provided below, it assumes you have PHP 8.1 installed with the PHP FPM extension installed</p>
89-
90-
```bash
91-
server {
92-
93-
listen 80;
94-
server_name invoiceninja.test;
95-
root /var/www/invoiceninja/public;
96-
index index.php index.html index.htm;
97-
client_max_body_size 20M;
98-
99-
gzip on;
100-
gzip_types application/javascript application/x-javascript text/javascript text/plain application/xml application/json;
101-
gzip_proxied no-cache no-store private expired auth;
102-
gzip_min_length 1000;
103-
104-
location / {
105-
try_files $uri $uri/ =404;
106-
}
107-
108-
location ~* \.pdf$ {
109-
add_header Cache-Control no-store;
110-
}
111-
112-
if (!-e $request_filename) {
113-
rewrite ^(.+)$ /index.php?q= last;
114-
}
115-
116-
location ~ \.php$ {
117-
include snippets/fastcgi-php.conf;
118-
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
119-
}
120-
121-
location ~ /\.ht {
122-
deny all;
123-
}
124-
125-
}
126-
```
127-
128-
<x-warning>
129-
Performance hint!
130-
131-
Enable gzip in your webserver configuration, this will dramatically improve the loading time of the application! Please see the above nginx configuration for a sample of how to load the components of the application with gzip.
132-
</x-warning>
133-
134-
##### Database server configuration
135-
136-
<p>Create a database on your MySQL compatible server and add a user that has full access to the database. Database configuration is out of the scope of this article, more information can be found <a href="https://dev.mysql.com/doc/refman/8.0/en/creating-database.html">here</a></p>
137-
138-
##### Cron configuration
139-
140-
<x-warning>
141-
Ensure you set the scheduler under the web server user i.e. `sudo -u www-data crontab -e`
142-
</x-warning>
143-
144-
<p>Invoice Ninja relies heavily on the Laravel Scheduler, for this to operate it requires that a cron job to be configured, edit your crontab and enter the following record.</p>
145-
146-
```bash
147-
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
148-
```
149-
150-
<p>If you are using shared hosting, then you will need to add an additional parameter to the cron command which looks like this:</p>
151-
152-
```
153-
* * * * * cd /path/to/root/folder && /usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1
154-
```
155-
156-
### Installation from git (Advanced)
157-
158-
<p>For power users installing the app from Github can be done with the following two steps</p>
159-
160-
```bash
161-
git clone --depth 1 -b v5.11.53 https://github.com/invoiceninja/invoiceninja.git
162-
163-
composer create-project --no-dev
164-
```
165-
166-
**Note** replace v5.11.53 with the latest tag version, you will also want to ensure that when performing updates, you use the latest tag version rather than a particular branch, ie v5-develop. This will ensure that you are not pulling in work in progress code.
167-
168-
169-
### Final setup steps
170-
171-
<p>Once you have configured your virtual host, copy the same .env file </p>
172-
173-
174-
```bash
175-
.env.example
176-
177-
```
178-
to
179-
180-
```bash
181-
.env
182-
183-
```
184-
<p>
185-
then create a database and point your browser to http://your.domain.com/setup - the setup process will check a number of system settings such as PDF generation, database and mail settings and also allow you to configure the first account on the system, click Submit and the app will setup your application and redirect you to the login page</p>
186-
187-
188-
#### Cron configuration
189-
<p>Invoice Ninja relies heavily on the Laravel Scheduler, for this to operate it requires that a cron job to be configured, edit your crontab and enter the following record</p>
190-
191-
<x-warning>
192-
Ensure you set the scheduler under the web server user i.e. `sudo -u www-data crontab -e`
193-
</x-warning>
194-
195-
```bash
196-
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
197-
```
198-
199-
Some Webservers require the Cronjob to end with `> /dev/null 2>&1` instead of `>> /dev/null 2>&1` for it to work.
200-
Also check if your Webserver Cronjob needs to be set with `/private_html/` instead of `/public_html/` within the path.
201-
And sometimes it's enough to put `php` instead of `/opt/alt/php73/usr/bin/php` in the cronjob scheduler command to execute.
202-
203-
If you still encounter errors, it may be helpful to temporarily remove `>> /dev/null 2>&1` from the cron, this should output the cron to the `cron.log`
204-
205-
If you are having troubles with your crons, have a look at the troubleshooting section [here](https://invoiceninja.github.io/en/self-host-troubleshooting/#cron-not-running-queue-not-running)
206-
207-
If you would like to improve the performance of your Invoice Ninja installation, then turning on the queue system will dramatically improve the performance of the application.
208-
209-
If you have root access to your system, then simply follow the Laravel [guide](https://laravel.com/docs/8.x/queues#supervisor-configuration) to configure the supervisor service to start and restart your queue.
210-
211-
You will then need to update the QUEUE_CONNECTION variable in the .env file as follows:
212-
213-
```
214-
QUEUE_CONNECTION=database
215-
```
216-
217-
If you are on shared hosting, it is possible to get the queues working by defining a new cron with the following configuration:
218-
219-
```
220-
*/5 * * * * cd /path/to/root/folder && /usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty
221-
```
222-
223-
Some people have different web hosting setups, so this might also work:
224-
225-
```
226-
*/5 * * * * php /home/admin/domains/site.com/private_html/invoices_site/artisan queue:work --stop-when-empty
227-
```
228-
229-
This cron will start a queue worker every 5 minutes and run any jobs that are in the queue and then gracefully terminate itself. This means any emails / notification may be queued for a small period of time prior to executing. If this amount of delay is acceptable, it is a great way to get queue's working on shared hosting.
230-
231-
If you prefer to manage the queues with Supervisor, then you will want to disable the internal Invoice Ninja commands which start the queue, to do this simly set the following .env var
232-
233-
```
234-
INTERNAL_QUEUE_ENABLED=false
235-
```
236-
237-
You will then have full control over the queue.
238-
239-
240-
## Shared Hosting
241-
242-
#### Server Requirements
243-
244-
We have tested Invoice Ninja v5 on shared hosting and can confirm that it does work. Softaculous has a one click installer which makes the entire setup process simple, however if you do not have Softaculous available it may still be possible to install Invoice Ninja. There are several checks you will need to do prior to confirming whether your Shared Host has the correctly enabled modules. Invoice Ninja relies on:
245-
246-
* proc_open
247-
* exec
248-
* open_basedir
249-
* fpassthru
250-
251-
Without these modules, you will not be able to run Invoice Ninja. We do include some preflight checks of these modules in the Setup workflow, but it is best to check with your host that they support these modules. Some hosts choose to disable these modules as they classify them as security risks.
252-
253-
#### Database configuration
254-
255-
Create a MySQL compatible database in your shared host control panel along with a database user, record the database name, username and password as you'll need this later. Ensure your database user has full access to the database you've just created.
256-
257-
#### Upload release asset
258-
259-
Download the latest release from our <a href="https://github.com/invoiceninja/invoiceninja/releases">Releases</a> page. Note, you'll want to find the latest release which will contain 3 files, the one you need will be annotated as invoiceninja.tar.
260-
261-
Upload this file to your shared host, typically if your webhost uses the industry standard cPanel, you'll want to upload the **invoiceninja.tar** file to the **public_html** directory. Once the upload has completed, using the file manager untar the file.
262-
263-
You will also need to copy/rename the .env.example file to .env
264-
265-
#### Run setup
266-
267-
Navigate to https://your.url.com/setup and fill in the form. The setup process will perform some pre flight checks and then attempt run the setup. If it has been successful you will be navigated to the Admin portal. If the setup fails for some reason, you'll be returned to the Setup screen with an error message, there may be additional errors reported in **storage/logs/laravel.log** that will provide more information where the setup has failed.
268-
269-
If you see a **404 webserver error** and use **sub.domain.com** make sure to point the path for the subdomain towards the `/public` folder from the extracted invoiceninja.tar file, for example: ``/domains/domain.com/public_html/invoices2/public/``
270-
271-
##### Add the cron job
272-
273-
Add the Laravel scheduler cron job, be sure to include the full path, for a cPanel host it should look like this:
274-
275-
```
276-
* * * * * cd /path/to/root/folder && /usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1
277-
```
278-
279-
## Mail Configuration
280-
281-
When configuring your email, please ensure all of the fields are filled in. In particular you _must_ include the MAIL_FROM_ADDRESS and MAIL_FROM_NAME to prevent errors such as
282-
283-
```bash
284-
Address in mailbox given [ ] does not comply with RFC 2822, 3.6.2.
285-
```
286-
287-
Here is a full example - using Gmail as an example.
288-
289-
```bash
290-
MAIL_MAILER=smtp
291-
MAIL_HOST=smtp.gmail.com
292-
MAIL_PORT=587
293-
MAIL_USERNAME="[email protected]"
294-
MAIL_PASSWORD="your_password_dont_forget_the_quotes!"
295-
MAIL_ENCRYPTION=tls
296-
MAIL_FROM_ADDRESS="[email protected]"
297-
MAIL_FROM_NAME="Full Name With Double Quotes"
298-
299-
```
300-
301-
<x-warning>
302-
NOTE: if you are using SSL encryption the MAIL_PORT is 465. TLS encryption is on port 587.
303-
</x-warning>
304-
305-
### Individual mail configurations per company
306-
307-
From v5.5.38 we support per company mail configurations.
308-
309-
What does this mean?
310-
311-
For example if you have two Companies, Acme co and Ninja co you can create separate mail server configurations for each company.
312-
313-
To configure this you will need to prefix your .env with the primary key of the company ie In your database open the companies table, and if the primary ID column is 1 for Acme co this would be the configuration
314-
315-
```
316-
1_MAIL_HOST=
317-
1_MAIL_PORT=
318-
1_MAIL_USERNAME=null
319-
1_MAIL_PASSWORD=null
320-
1_MAIL_ENCRYPTION=null
321-
```
322-
323-
If Ninja Co company id 5
324-
325-
```
326-
5_MAIL_HOST=
327-
5_MAIL_PORT=
328-
5_MAIL_USERNAME=null
329-
5_MAIL_PASSWORD=null
330-
5_MAIL_ENCRYPTION=null
331-
```
332-
333-
## Currency Conversion
334-
335-
<p>Invoice Ninja supports <a href="https://openexchangerates.org/">Open Exchange</a> for currency conversion.
336-
Open Exchange currently provides a free tier which is suitable for daily updates of the exchange rates.
337-
Simply insert a Open Exchange API key into your .env file to enable exchange rate updates:</p>
338-
339-
```bash
340-
OPENEXCHANGE_APP_ID=your_open_exchange_api_key_here
341-
```
342-
343-
Currencies are updated automatically by using the scheduler. In case the currencies are not available within the UI please double check the database table `currencies` and ensure that `exchange_rate` fields contains realistic values.
9+
Content has moved to https://invoiceninja.github.io/en/self-host-installation/

0 commit comments

Comments
 (0)