0

I am trying to configure NGINX to run a PHP application installed at two locations:

/var
  /www
    /apps
      /aero
        /ywg
          /public
            index.php
        /lft
          /public
            index.php

These need to be accessed from the URI's:

http://apps.domain.com/aero/ywg
http://apps.domain.com/aero/lft

Here is what I have - php is downloading not executing:

server {
       listen 80 default_server;

       server_name _;
       root /var/www/apps;
       index index.php index.html;

       location /aero/ywg {
            alias /var/www/apps/aero/ywg/public;

            try_files $uri $uri/ @aeroywg;

            location ~ ^/index\.php(/|$) {
                fastcgi_pass unix:/run/php/php7.1-fpm.sock;
                fastcgi_split_path_info ^(.+\.php)(/.*)$;

                include fastcgi_params;

                fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
                fastcgi_param DOCUMENT_ROOT $realpath_root;

                internal;
            }

       }

       location @aeroywg {
            rewrite /aero/ywg/(.*)$ /aero/ywg/index.php?/$1 last;
       }

}

/etc/php/7.1/fpm/php.ini

cgi.fix_pathinfo=0

PHP files are being returned as source code...any ideas?

Alex.Barylski
  • 2,843
  • 4
  • 45
  • 68

0 Answers0