NGINX多位置单服务器

时间:2019-03-18 17:05:26

标签: nginx nginx-location

我正在尝试配置NGINX以运行安装在两个位置的PHP应用程序:

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

这些需要从URI进行访问:

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

这里是我所拥有的-php正在下载但未执行:

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文件将作为源代码返回...有什么想法吗?

0 个答案:

没有答案