Nginx and php upload_max_filesize : other setups

Nginx and PHP-FPM Installation

inShare
Jump to: navigation, search

Nginx Installation in ProcessMaker has been included under an experimental section, since this installation has not being tested by QA Department yet, so this is not officialy supported by ProcessMaker.

Follow these instructions to install ProcessMaker 2.0 on top of a LNMP (Linux, Nginx, MySQL, PHP-FPM) stack in Ubuntu (Maverick Meerkat) 10.10 and later.

Nginx

nginx (pronounced “Engine X” is a lightweight, high-performance server. It’s used among websites with high traffic to improve page responses and serving external files (CSS, JS, images) faster and with less memory footprint than the Apache webserver.

PHP-FPM

PHP-FastCGI Process Manager is a set of patches for PHP to work with the FastCGI process manager, turning PHP-FPM into a service rather than loading all of its libraries everytime a PHP request it’s made. PHP-FPM it’s used in conjunction with Nginx to drastically improve performance and to deal with many concurrent users.

Install Nginx, PHP-FPM and MySQL

Please note: You need to have the Apache webserver uninstalled or stopped to install Nginx

Open a shell by going to Applications > Accessories > Terminal. Enter the following:

sudo apt-get install nginx mysql-server mysql-client php5-fpm php5-mysql php5-curl php5-cli php5-common php5-geoip php5-mcrypt php5-memcache php-xml-serializer php-xml-parser php-soap php5-ldap php5-gd

When apt-get installs MySQL, a dialog box will appear asking for a new root password for MySQL.

EnterMySQLRootPassword.png

Enter a password and select the option OK. If everything worked, you should be able to go to http://localhost

Install ProcessMaker

Follow the instructions at http://wiki.processmaker.com/index.php/2.0/ProcessMaker_Ubuntu_Installation#Install_ProcessMaker

Configure MySQL

Follow the instructions at http://wiki.processmaker.com/index.php/2.0/ProcessMaker_Ubuntu_Installation#Configure_MySQL

Configure PHP-FPM

Type this in your terminal:

sudo vi /etc/nginx/nginx.conf

locate the worker_processes line and change it to this:

worker_processes 5;

save the changes and close the file.

We also need to edit the php.ini file:

sudo vi /etc/php5/fpm/php.ini

Each ProcessMaker session needs a minimum of 80MB RAM to run properly, so set the memory_limit to 80M or greater:

memory_limit = 80M

In order to upload Input Documents, upgrade ProcessMaker and add plugins and languages, file_uploads need to be enabled:

file_uploads = On

ProcessMaker needs to use PHP’s short opening tags:

short_open_tag = On

If planning on uploading large Input Documents while running processes, the post_max_size and upload_max_filesize should be increased to more than the default 2MB. For instance, if planning on uploading files as large as 16MB, then:

post_max_size = 16M 
upload_max_filesize = 16M

Now we restart the PHP-FPM service:

sudo /etc/init.d/php5-fpm stop
sudo /etc/init.d/php5-fpm start

Configure Nginx

The last step is to configure Nginx. We’ll follow the same structure found on http://wiki.processmaker.com/index.php/2.0/ProcessMaker_Ubuntu_Installation#Configure_Apache but using nginx directives:

sudo vi /etc/nginx/sites-available/pmos

Copy and paste the following:

server {
listen your_ip_address:80;
server_name _;
root /opt/processmaker/workflow/public_html;
index index.html;
rewrite ^/.*/(.*)$ /sysGeneric.php last;
# Every PHP script must be routed to PHP-FPM
location ~ \.php$ {
     if(!-f $request_filename) { return 404; }
     fastcgi_pass     127.0.0.1:9000;
     fastcgi_index    index.php;
     fastcgi_param    SCRIPT_FILENAME   /opt/processmaker/workflow/public_html$fastcgi_script_name;
     include fastcgi_params;
  }
}

Replace your_ip_address with the IP number or domain name of the server running ProcessMaker. If only planning on running and accessing ProcessMaker on your local machine, then use the IP address “127.0.0.1”. If using ProcessMaker on a machine whose IP address might change (such as a machine whose IP address is assigned with DHCP), then just use “80”.

If your DNS or /etc/hosts has a defined domain for ProcessMaker, then use that domain instead of the underscore “_” on the server_name line. Otherwise, just leave it as it is.

Now we need to enable the processmaker site:

sudo ln -s /etc/nginx/sites-available/pmos /etc/nginx/sites-enabled/pmos

Restart the server

sudo /etc/init.d/nginx restart

Setting Up ProcessMaker

Follow the instructions at http://wiki.processmaker.com/index.php/2.0/ProcessMaker_Ubuntu_Installation#Setting_up_ProcessMaker

SSL on Nginx

Nginx has an SSL module which can be used with ProcessMaker. Read more at http://wiki.nginx.org/HttpSslModule

Advertisements

67 thoughts on “Nginx and php upload_max_filesize : other setups

  1. I simply couldn’t leave your web site prior to suggesting that I really enjoyed the standard information an individual supply on your visitors? Is going to be again incessantly to investigate cross-check new posts

  2. Good day! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in trading links or maybe guest
    authoring a blog article or vice-versa? My site goes over a lot of the same subjects as yours and I think we could greatly benefit from each other.
    If you might be interested feel free to send me an e-mail.
    I look forward to hearing from you! Excellent blog by the way!

  3. hello!,I like your writing so much! percentage we keep
    up a correspondence extra about your post on AOL?
    I require a specialist on this house to solve my problem.
    Maybe that is you! Taking a look forward to see you.

  4. When someone writes an post he/she keeps the image of a user
    in his/her brain that how a user can know it.
    Thus that’s why this paragraph is outstdanding. Thanks!

  5. Admiring the dedication you put into your site and
    detailed information you offer. It’s nice to come across a blog every once in a while that isn’t the
    same old rehashed material. Great read! I’ve bookmarked your site and I’m adding your RSS feeds to my
    Google account.

  6. Good web site you have here.. It’s difficult to find good quality writing like yours these days. I truly appreciate people like you! Take care!!

  7. Thanks a bunch for sharing this with all people you really recognise what you’re talking approximately! Bookmarked. Please additionally consult with my web site =). We can have a hyperlink exchange contract between us

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s