Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
vms:invoiceninja [2015/09/04 02:01] admin [Prepare the Environment] |
vms:invoiceninja [2015/09/04 02:58] (current) admin [Backup the Database] |
||
---|---|---|---|
Line 159: | Line 159: | ||
---- | ---- | ||
- | ==== Create a new PHP-FPM pool for your our user ==== | + | ==== Create a New PHP-FPM Pool for Our User ==== |
(the following commands are to be executed as **root**, or using **sudo**) | (the following commands are to be executed as **root**, or using **sudo**) | ||
<code> | <code> | ||
- | > nano /etc/php5/fpm/pool.d/ininja.conf | + | > nano /etc/php5/fpm/pool.d/<ininja>.conf |
PASTE: | PASTE: | ||
Line 178: | Line 179: | ||
pm.max_requests = 200 | pm.max_requests = 200 | ||
chdir = / | chdir = / | ||
+ | |||
+ | > service php5-fpm restart | ||
</code> | </code> | ||
Once again do not forget to substitute ''%%<ininja>%%'' with the user name you created earlier. | Once again do not forget to substitute ''%%<ininja>%%'' with the user name you created earlier. | ||
+ | |||
+ | ---- | ||
+ | ==== Generate a Self Signed SSL Certificate ==== | ||
+ | |||
+ | <code> | ||
+ | > mkdir -p /etc/nginx/ssl | ||
+ | > cd /etc/nginx/ssl | ||
+ | > openssl genrsa -des3 -passout pass:x -out ininja.pass.key 2048 | ||
+ | > openssl rsa -passin pass:x -in ininja.pass.key -out ininja.key | ||
+ | > rm ininja.pass.key | ||
+ | > openssl req -new -key ininja.key -out ininja.csr | ||
+ | > openssl x509 -req -days 365 -in ininja.csr -signkey ininja.key -out ininja.crt | ||
+ | </code> | ||
+ | |||
+ | ---- | ||
+ | ==== Create a New Nginx Server Block ==== | ||
+ | |||
+ | <code> | ||
+ | > nano /etc/nginx/sites-available/ininja | ||
+ | |||
+ | PASTE: | ||
+ | server { | ||
+ | listen 443 default; | ||
+ | server_name ininja; | ||
+ | |||
+ | ssl on; | ||
+ | ssl_certificate /etc/nginx/ssl/ininja.crt; | ||
+ | ssl_certificate_key /etc/nginx/ssl/ininja.key; | ||
+ | ssl_session_timeout 5m; | ||
+ | |||
+ | ssl_ciphers 'AES128+EECDH:AES128+EDH:!aNULL'; | ||
+ | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | ||
+ | ssl_prefer_server_ciphers on; | ||
+ | |||
+ | root /var/www/ininja/public; | ||
+ | |||
+ | index index.html index.htm index.php; | ||
+ | |||
+ | charset utf-8; | ||
+ | |||
+ | location / { | ||
+ | try_files $uri $uri/ /index.php?$query_string; | ||
+ | } | ||
+ | |||
+ | location = /favicon.ico { access_log off; log_not_found off; } | ||
+ | location = /robots.txt { access_log off; log_not_found off; } | ||
+ | |||
+ | access_log /var/log/nginx/ininja.access.log; | ||
+ | error_log /var/log/nginx/ininja.error.log; | ||
+ | |||
+ | sendfile off; | ||
+ | |||
+ | location ~ \.php$ { | ||
+ | fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
+ | fastcgi_pass unix:/var/run/php5-fpm-ininja.sock; | ||
+ | fastcgi_index index.php; | ||
+ | include fastcgi_params; | ||
+ | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
+ | fastcgi_intercept_errors off; | ||
+ | fastcgi_buffer_size 16k; | ||
+ | fastcgi_buffers 4 16k; | ||
+ | } | ||
+ | |||
+ | location ~ /\.ht { | ||
+ | deny all; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | server { | ||
+ | listen 80; | ||
+ | server_name 172.20.20.10; | ||
+ | |||
+ | add_header Strict-Transport-Security max-age=2592000; | ||
+ | rewrite ^ https://$server_name$request_uri? permanent; | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | You'll need to adapt the "ininja" values to your configuration... Also we've used the IP as server name as we're using a VM, you'd need to put the FQDN of your server in case your are deploying on a production machine. | ||
+ | |||
+ | === Activate the server block === | ||
+ | |||
+ | This is done by creating a symbolic link from /etc/nginx/sites-available/ to /etc/nginx/sites-enabled/, then restarting nginx: | ||
+ | <code> | ||
+ | > ln -s /etc/nginx/sites-available/<ininja> /etc/nginx/sites-enabled/<ininja> | ||
+ | > service nginx restart | ||
+ | </code> | ||
+ | |||
+ | ---- | ||
+ | ===== Start Using Invoice Ninja ===== | ||
+ | ---- | ||
+ | |||
+ | Directing a web browser to your VM's IP should now display the **Invoice Ninja Setup** page, enjoy ! | ||
+ | |||
+ | ---- | ||
+ | ==== Backup the Database ==== | ||
+ | |||
+ | For development purposes it might sometimes be usefull to make a backup of the database at a certain state. To do that, use the ''%%mysqldump%%'' command: | ||
+ | |||
+ | **backup**: | ||
+ | <code> | ||
+ | > mysqldump -uininja -p ininja > /path/to/ininja-state.sql | ||
+ | Enter password: | ||
+ | </code> | ||
+ | |||
+ | **restore**: | ||
+ | <code> | ||
+ | > mysql -uininja -p ininja < /path/to/ininja-state.sql | ||
+ | Enter password: | ||
+ | </code> |