Ngnix configuration and Apache replacement

These steps lead to the replacement of Apache was the Shuttle webserver with Nginx one.

Step-by-step guide

  1. install the following packages:
    yum install nginx php-fpm
  2. configure php-fpm:
    sed -i 's/apache/nginx/' /etc/php-fpm.d/www.conf sed -i 's/9000/9090/' /etc/php-fpm.dwww.conf
  3. configure php:
    sed -i 's/\(extension=php_imap.dll\)/;\1/' /etc/php.ini sed -i 's/\(extension=php_openssl.dll\)/;\1/' /etc/php.ini
  4. configure Nginx by adding the shuttle.conf file attached in this post in the following position:
    /etc/nginx/conf.d/

    shuttle.conf
    server {
            listen       80;
            server_name  _;
            return 301 https://$host$request_uri;
    }
    
    server {
            listen 443 ssl default_server;
            server_name  _;
            client_max_body_size 16M;
            autoindex on;
            index index.php;
    
            ssl_certificate /etc/pki/tls/certs/localhost.crt;
            ssl_certificate_key /etc/pki/tls/private/localhost.key;
    
            location / {
                    try_files $uri $uri/ /index.php;
    
                    location = /index.php {
                            fastcgi_pass   127.0.0.1:9090;
                            fastcgi_param  SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
                            include  fastcgi_params;
                }
            }
    
            location /api {
                    # redirect all HTTPS traffic to localhost:9000
                    proxy_pass http://127.0.0.1:3000;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header Host $host;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    
                    proxy_connect_timeout 600;
                    proxy_send_timeout 600;
                    proxy_read_timeout 600;
                    send_timeout 600;
            }
    }
  5. remove default html folder and add link under default Nginx doc folder:
    rm -rf /usr/share/nginx/html
    ln -s /var/www/html /usr/share/nginx/html
  6. change owner and grup to audit log file and html folder:
    chown nginx:nginx /var/log/xcally-audit.log
    chown -R nginx:nginx /var/www/html
  7. disable httpd and enable php-fpm / nginx in systemctl:
    systemctl disable httpd
    systemctl enable php-fpm
    systemctl enable nginx
  8. start php-fpm and nginx processes:
    service php-fpm start
    service nginx start

  9. After this try to login to the UI.