/
Nginx Webserver and PHP 7.1 Upgrade Guide
Nginx Webserver and PHP 7.1 Upgrade Guide
Back to Installation and Setup
Introduction
This page is intended to record the process for upgrading the dependencies of a system that was previously on IFS Workflow Engine 1.1 before upgrading to IFS Workflow Engine 1.2.
Post Upgrade Steps
After the upgrade steps have been performed either manually or scripted, a file requires an additional manual update. The /etc/nginx/conf.d/processmaker.conf file has a line server_name nginx.processmaker.com; near the top of the file. The nginx.processmaker.com needs to be changed to the name of the server which is running IFS Workflow.
Script Content
#Stop apache
service httpd stop
#Remove apache from auto start
chkconfig httpd off
##Optionally apache can be removed entirely
#yum -y remove httpd
#Install NGINX
#To install NGINX follow these steps:
##1. Add the NGINX repository file.
#vi /etc/yum.repos.d/nginx.repo
#
##2. Add the next lines in the created repository file.
#[nginx]
#name=nginx repo
######rhel/6 should be changed to rhel/7 for RHEL/CentOS 7
#baseurl=http://nginx.org/packages/rhel/7/$basearch/
#gpgcheck=0
#enabled=1
#Add Nginx Repository
echo -e "[nginx]\nname=nginx repo\n#####rhel/6 should be changed to rhel/7 for RHEL/CentOS 7\nbaseurl=http://nginx.org/packages/rhel/7/\$basearch/\ngpgcheck=0\nenabled=1" > /etc/yum.repos.d/nginx.repo
#3. Install NGINX and start the service.
#Install Nginx
yum clean all && yum -y install nginx
#Start Nginx
service nginx start
#Add Nginx to auto start on server restart
chkconfig nginx on
#Backup default.conf and rename it so that it's not picked up
mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.bk
#vi /etc/nginx/conf.d/processmaker.conf
##ProcessMaker HTTP Virtual Host
#
#server {
#
# listen 80;
# listen [::]:80;
# #Change for server DNS name
# server_name nginx.processmaker.com;
# #The following line must be added Only if phpMyAdmin is configured
# #include /opt/phpMyAdmin/phpMyAdmin.conf;
#
# root /opt/processmaker/workflow/public_html; #where ProcessMaker is installed
#
# index index.html index.htm app.php index.php;
#
# try_files $uri $uri/ /index.php?$args;
#
# 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/pm-access.log combined; #enables access logs
#
# error_log /var/log/nginx/pm-error.log error; #enables error logs
#
# sendfile off;
#
# client_max_body_size 100m;
#
# # Every PHP script must be routed to PHP-FPM
#
# location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# fastcgi_pass unix:/var/run/php-fpm/processmaker.sock;
# fastcgi_index app.php;
#
# include fastcgi_params;
# fastcgi_param SCRIPT_FILENAME /opt/processmaker/workflow/public_html/app.php;
# fastcgi_intercept_errors off;
# fastcgi_buffers 8 16k;
# fastcgi_buffer_size 32k;
# fastcgi_connect_timeout 300;
# fastcgi_send_timeout 300;
# fastcgi_read_timeout 300;
#
# }
#
# #Browser Caching
#
# location ~* \.(ico|css|js|gif|jpeg|jpg|png|woff|ttf|otf|svg|woff2|eot)$ {
# expires 24h;
# add_header Cache-Control public;
# access_log off;
# log_not_found off;
#
# fastcgi_pass unix:/var/run/php-fpm/processmaker.sock;
#
# fastcgi_index app.php;
#
# include fastcgi_params;
#
# fastcgi_param SCRIPT_FILENAME /opt/processmaker/workflow/public_html/app.php;
#
# fastcgi_intercept_errors off;
#
# fastcgi_buffers 8 16k;
#
# fastcgi_buffer_size 32k;
#
# fastcgi_connect_timeout 300;
#
# fastcgi_send_timeout 300;
#
# fastcgi_read_timeout 300;
# }
#
#
# location ~ /\.ht {
# deny all;
# }
#
# error_page 404 /404.html;
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root /usr/share/nginx/html;
# }
#
#}
#Create temporary processmaker configuration file
################### NOTE: nginx.processmaker.com NEEDS TO BE REPLACED WITH THE NAME OF THE SERVER ###############################
echo -e "#ProcessMaker HTTP Virtual Host\n \nserver {\n \n listen 80;\n listen [::]:80;\n #Change for server DNS name\n server_name nginx.processmaker.com;\n #The following line must be added Only if phpMyAdmin is configured\n #include /opt/phpMyAdmin/phpMyAdmin.conf;\n \n root /opt/processmaker/workflow/public_html; #where ProcessMaker is installed\n \n index index.html index.htm app.php index.php;\n \n try_files \$uri \$uri/ /index.php?\$args;\n \n charset utf-8;\n \n location / {\n try_files \$uri \$uri/ /index.php?\$query_string;\n }\n \nlocation = /favicon.ico { access_log off; log_not_found off; }\n \n location = /robots.txt { access_log off; log_not_found off; }\n \n access_log /var/log/nginx/pm-access.log combined; #enables access logs\n \n error_log /var/log/nginx/pm-error.log error; #enables error logs\n \n sendfile off;\n \n client_max_body_size 100m;\n \n # Every PHP script must be routed to PHP-FPM\n \n location ~ \.php\$ {\n fastcgi_split_path_info ^(.+\.php)(/.+)\$;\n fastcgi_pass unix:/var/run/php-fpm/processmaker.sock;\n fastcgi_index app.php;\n \n include fastcgi_params;\n fastcgi_param SCRIPT_FILENAME /opt/processmaker/workflow/public_html/app.php;\n fastcgi_intercept_errors off;\n fastcgi_buffers 8 16k;\n fastcgi_buffer_size 32k;\n fastcgi_connect_timeout 300;\n fastcgi_send_timeout 300;\n fastcgi_read_timeout 300;\n \n }\n \n #Browser Caching\n \n location ~* \.(ico|css|js|gif|jpeg|jpg|png|woff|ttf|otf|svg|woff2|eot)\$ {\n expires 24h;\n add_header Cache-Control public;\n access_log off;\n log_not_found off;\n \n fastcgi_pass unix:/var/run/php-fpm/processmaker.sock;\n \n fastcgi_index app.php;\n \n include fastcgi_params;\n \n fastcgi_param SCRIPT_FILENAME /opt/processmaker/workflow/public_html/app.php;\n \n fastcgi_intercept_errors off;\n \n fastcgi_buffers 8 16k;\n \n fastcgi_buffer_size 32k;\n \n fastcgi_connect_timeout 300;\n \n fastcgi_send_timeout 300;\n \n fastcgi_read_timeout 300;\n }\n \n \n location ~ /\.ht {\n deny all;\n }\n \n error_page 404 /404.html;\n error_page 500 502 503 504 /50x.html;\n location = /50x.html {\n root /usr/share/nginx/html;\n }\n \n}\n" > /etc/nginx/conf.d/processmaker.conf.tmp
#Create conf file only if it doesn't already exist
cp -n /etc/nginx/conf.d/processmaker.conf.tmp /etc/nginx/conf.d/processmaker.conf
#Remove temp conf file
rm -f /etc/nginx/conf.d/processmaker.conf.tmp
#vi /etc/nginx/nginx.conf
#Contents for nginx.conf
#user nginx;
#
#
#worker_processes auto;
#
#
#error_log /var/log/nginx/error.log warn;
#
#
#pid /var/run/nginx.pid;
#
#
## Load dynamic modules. See /usr/share/nginx/README.dynamic.
#
#
#include /usr/share/nginx/modules/*.conf;
#
#
#events {
#
# worker_connections 1024;
#
#}
#
#
#http {
#
# include /etc/nginx/mime.types;
#
# default_type application/octet-stream;
#
# log_format main '$remote_addr - $remote_user [$time_local] "$request" '
#
# '$status $body_bytes_sent "$http_referer" '
#
# '"$http_user_agent" "$http_x_forwarded_for"';
#
# access_log /var/log/nginx/access.log main;
#
# log_format combined_ssl '$remote_addr - $remote_user [$time_local] '
#
# '$ssl_protocol/$ssl_cipher '
#
# '"$request" $status $body_bytes_sent '
#
# '"$http_referer" "$http_user_agent"';
#
# sendfile on;
#
# tcp_nopush on;
#
# tcp_nodelay on;
#
# keepalive_timeout 120;
#
# keepalive_requests 100;
#
# types_hash_max_size 2048;
#
#
# #Enable Compression
#
# gzip on;
#
# gzip_disable "msie6";
#
# gzip_vary on;
#
# gzip_proxied any;
#
# gzip_comp_level 6;
#
# gzip_buffers 16 8k;
#
# gzip_http_version 1.1;
#
# gzip_types text/css text/plain text/xml text/x-component text/javascript application/x-javascript application/javascript application/json application/xml application/xhtml+xml application/x-font-ttf application/x-font-opentype application/x-font-truetype image/svg+xml image/x-icon image/vnd.microsoft.icon font/ttf font/eot font/otf font/opentype;
#
#
# include /etc/nginx/conf.d/*.conf;
#
#
##Comment out ServerTokens OS
#
# server_tokens off;
#
#
# #Prevent ClickJacking Attacks
#
# add_header X-Frame-Options SAMEORIGIN;
#
#
# #Load Balancer/Reverse Proxy Header
#
# real_ip_header X-Forwarded-For;
#
# set_real_ip_from 0.0.0.0/0;
#
#}
#Create nginx configuration file
echo -e "user nginx;\n\n\nworker_processes auto;\n\n\nerror_log /var/log/nginx/error.log warn;\n\n\npid /var/run/nginx.pid;\n\n\n# Load dynamic modules. See /usr/share/nginx/README.dynamic.\n\n\ninclude /usr/share/nginx/modules/*.conf;\n\n\nevents {\n\n worker_connections 1024;\n\n}\n\n\nhttp {\n\n include /etc/nginx/mime.types;\n\n default_type application/octet-stream;\n\n log_format main '\$remote_addr - \$remote_user [\$time_local] "\$request" '\n\n '\$status \$body_bytes_sent "\$http_referer" '\n\n '"\$http_user_agent" "\$http_x_forwarded_for"';\n\n access_log /var/log/nginx/access.log main;\n\n log_format combined_ssl '\$remote_addr - \$remote_user [\$time_local] '\n\n '\$ssl_protocol/\$ssl_cipher '\n\n '"\$request" \$status \$body_bytes_sent '\n\n '"\$http_referer" "\$http_user_agent"';\n\n sendfile on;\n\n tcp_nopush on;\n\n tcp_nodelay on;\n\n keepalive_timeout 120;\n\n keepalive_requests 100;\n\n types_hash_max_size 2048;\n\n\n #Enable Compression\n\n gzip on;\n\n gzip_disable "msie6";\n\n gzip_vary on;\n\n gzip_proxied any;\n\n gzip_comp_level 6;\n\n gzip_buffers 16 8k;\n\n gzip_http_version 1.1;\n\n gzip_types text/css text/plain text/xml text/x-component text/javascript application/x-javascript application/javascript application/json application/xml application/xhtml+xml application/x-font-ttf application/x-font-opentype application/x-font-truetype image/svg+xml image/x-icon image/vnd.microsoft.icon font/ttf font/eot font/otf font/opentype;\n\n\n include /etc/nginx/conf.d/*.conf;\n\n\n#Comment out ServerTokens OS\n\n server_tokens off;\n\n\n #Prevent ClickJacking Attacks\n\n add_header X-Frame-Options SAMEORIGIN;\n\n\n #Load Balancer/Reverse Proxy Header\n\n real_ip_header X-Forwarded-For;\n\n set_real_ip_from 0.0.0.0/0;\n\n}" > /etc/nginx/nginx.conf
#Uninstall older php versions
yum -y remove php*
yum -y remove php php-fpm php-cli php-common
#Add PHP repositories
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
#Install PHP 7.1
yum -y install php71w php71w-cli php71w-opcache php71w-fpm php71w-gd php71w-mysqlnd php71w-soap php71w-mbstring php71w-ldap php71w-mcrypt php71w-xml
#Start PHP FPM
service php-fpm start
#Add PHP FPM to autostart
chkconfig php-fpm on
#Configure PHP FPM
sed -i '/short_open_tag = Off/c\short_open_tag = On' /etc/php.ini
sed -i '/post_max_size = 8M/c\post_max_size = 24M' /etc/php.ini
sed -i '/upload_max_filesize = 2M/c\upload_max_filesize = 24M' /etc/php.ini
sed -i '/;date.timezone =/c\date.timezone = America/New_York' /etc/php.ini
sed -i '/expose_php = On/c\expose_php = Off' /etc/php.ini
#Configure OpCache
sed -i '/;opcache.enable_cli=0/c\opcache.enable_cli=1' /etc/php.d/opcache.ini
sed -i '/opcache.max_accelerated_files=4000/c\opcache.max_accelerated_files=10000' /etc/php.d/opcache.ini
sed -i '/;opcache.max_wasted_percentage=5/c\opcache.max_wasted_percentage=5' /etc/php.d/opcache.ini
sed -i '/;opcache.use_cwd=1/c\opcache.use_cwd=1' /etc/php.d/opcache.ini
sed -i '/;opcache.validate_timestamps=1/c\opcache.validate_timestamps=1' /etc/php.d/opcache.ini
sed -i '/;opcache.fast_shutdown=0/c\opcache.fast_shutdown=1' /etc/php.d/opcache.ini
#vi /etc/php-fpm.d/processmaker.conf
#Contents for processmaker.conf
#[processmaker]
#
#user = nginx
#
#group = nginx
#
#listen = /var/run/php-fpm/processmaker.sock
#
#listen.mode = 0664
#
#listen.owner = nginx
#
#listen.group = nginx
#
#pm = dynamic
#
#pm.max_children = 100
#
#pm.start_servers = 20
#
#pm.min_spare_servers = 20
#
#pm.max_spare_servers = 50
#
#pm.max_requests = 500
#
#php_admin_value[error_log] = /var/log/php-fpm/processmaker-error.log
#
#php_admin_flag[log_errors] = on
#Create PHP FPM configuration file
echo -e "[processmaker]\n\nuser = nginx\n\ngroup = nginx\n\nlisten = /var/run/php-fpm/processmaker.sock\n\nlisten.mode = 0664\n\nlisten.owner = nginx\n\nlisten.group = nginx\n\npm = dynamic\n\npm.max_children = 100 \n\npm.start_servers = 20\n\npm.min_spare_servers = 20\n\npm.max_spare_servers = 50\n\npm.max_requests = 500\n\nphp_admin_value[error_log] = /var/log/php-fpm/processmaker-error.log\n\nphp_admin_flag[log_errors] = on" > /etc/php-fpm.d/processmaker.conf
chown -R nginx:nginx /opt/processmaker
#Restart php-fpm for changes to apply
service php-fpm restart
#Restart nginx for changes to apply
service nginx restart
, multiple selections available,
Copyright© 2024 IFS AB. Copying prohibited. All rights reserved.