Siwapp with Nginx

First download the Siwapp version 0.4.1 first.

Downloading File

cd /var/www/domain/siwapp.comquas.com/
wget http://www.siwapp.org/downloads/siwapp_0_4_1.beta.tar.gz
tar -zxvf siwapp_0_4_1.beta.tar.gz
rm siwapp_0_4_1.beta.tar.gz
mv siwapp/* ./
rm -r siwapp

Now , we have 0.4.1 in /var/www/domain/siwapp.comquas.com

Editing Installer

For nginx with siwapp , we need to edit preinstaller_code.php.

Edit /var/www/domain/siwapp.comquas.com/web/preinstaller_code.php

edit it and remove or comment the line 59

// check for mod_rewrite. test_rewrite1.txt should be rewrited to

// test_rewrite2.txt

$installer_url = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

$rewrite_url = substr($installer_url,0,strrpos($installer_url,'/')+1).'test_rewrite1.txt';

$wrong['rewrite'] = strpos(file_get_contents($rewrite_url), 'test_rewrite2') === false;

ref: Help install siwapp on nginx web server

Config Nginx for Installing

Edit your /etc/nginx/site-available/siwapp.comquas.com or /etc/nginx/site-enable/siwapp.comquas.com

server {
     listen 80; ## listen for ipv4; this line is default and implied
     #listen [::]:80 default_server ipv6only=on; ## listen for ipv6

     server_name siwapp.comquas.com;

     root /var/www/domain/siwapp.comquas.com/web;
     index index.php index.html index.htm;

     access_log /var/log/nginx/siwapp.comquas.com.access;
     error_log /var/log/nginx/siwapp.comquas.com.error;

     location ~ \.php($|/) {
         set $script $uri;
         set $path_info "";

         if ($uri ~ "^(.+\.php)(/.*)") {
             set $script $1;
             set $path_info $2;
         }

         include /etc/nginx/fastcgi_params;

         fastcgi_pass 127.0.0.1:9000;
         fastcgi_param SCRIPT_FILENAME $document_root$script;
         fastcgi_param SCRIPT_NAME $script;
     }

    }

ref: stackoverflow

Reload the nginx

sudo /etc/init.d/ngninx reload

Change Permission

We need to do change permission before instllation

sudo chown www-data /var/www/domain/siwapp.comquas.com/web/uploads
sudo chmod 775 /var/www/domain/siwapp.comquas.com/web/uploads

sudo chown www-data /var/www/domain/siwapp.comquas.com/config/databases.yml
sudo chmod 775 /var/www/domain/siwapp.comquas.com/web/uploads

sudo chown www-data /var/www/domain/siwapp.comquas.com/web/config.php
sudo chmod 775 /var/www/domain/siwapp.comquas.com/web/config.php

Installation

Open your siwapp website. Now, I am using http://siwapp.comquas.com and will see like following.

Installer

You need to check everything is OK at step 2

per install

After finish installation you need to edit permission

permission

Type following command

sudo chmod 644 /var/www/domain/siwapp.comquas.com/config/databases.yml

sudo chmod 644 /var/www/domain/siwapp.comquas.com/web/config.php

After Installing

You need to edit again nginx file to run siwapp. Siwapp is using symfony 1.4 and we need to config it.

Edit your /etc/nginx/site-available/siwapp.comquas.com or /etc/nginx/site-enable/siwapp.comquas.com

server {

    listen 80; ## listen for ipv4; this line is default and implied

    #listen [::]:80 default_server ipv6only=on; ## listen for ipv6

    server_name siwapp.comquas.com;
    root /var/www/domain/siwapp.comquas.com/web;
    index index.php index.html index.htm;

    access_log /var/log/nginx/siwapp.comquas.com.access;
    error_log /var/log/nginx/siwapp.comquas.com.error;

    location ~ ^/(index|frontend|frontend_dev|backend|backend_dev)\.php$ {

       include fastcgi_params;

       fastcgi_split_path_info ^(.+\.php)(/.+)$;

       fastcgi_param PATH_INFO $fastcgi_path_info;

       fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

       fastcgi_param HTTPS off;

       fastcgi_pass 127.0.0.1:9000;

     }

     location / {

       index index.php;

       try_files $uri /index.php?$args;

     }

    }

ref: symfony 1.4 and nginx

sudo /etc/init.d/ngninx reload

Try to open siwapp website and everything will working fine.

done

comments powered byDisqus