Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vms:invoiceninja [2015/09/04 02:05]
admin [Create a New PHP-FPM Pool for Our User]
vms:invoiceninja [2015/09/04 02:58] (current)
admin [Backup the Database]
Line 198: Line 198:
 </​code>​ </​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>​