nginx 位置不指向不同的文件

nginx 位置不指向不同的文件

在我的公共文件夹中,我有

$ ls public
index.php   mGSV

$ ls public/mGSV/
ARCHITECTURE.txt    Install         base_mgsv.php       history.php     index.php       mgsv.php        scripts         tmp
Arial.ttf       README          contact.php     html            js          sample_annotation.txt   software.php        tutorial.php
INSTALLATION        about.php       css         img         lib         sample_synteny.txt  summary.php     ws

如何访问localhost/index.php并且localhost/mGSV/index.php我尝试了以下 nginx,default.conf但它们都指向同一个index.php文件?

server {
    listen  80;

    root /usr/share/nginx/html/;
    index index.php index.html index.html;

    server_name localhost;

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location /mGSV {
        try_files $uri /index.php$is_args$args;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass phpfpm:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

我的docker-compose.yml文件如下所示:

nginx:
    image: nginx
    restart: always
    ports:
        - "80:80"
    links:
        - phpfpm
        - db
    volumes:    
        - ./logs/nginx-error.log:/var/log/nginx/error.log
        - ./logs/nginx-access.log:/var/log/nginx/access.log

        - ./nginx/default:/etc/nginx/conf.d/default.conf

phpfpm:
    build: php5-fpm
    restart: always
    ports:
        - "9000:9000"
    links:
        - db
    volumes:
        - ./public:/usr/share/nginx/html

db:
  image: mariadb
  restart: always
  environment:
    - MYSQL_ROOT_PASSWORD=admin
    - MYSQL_DATABASE=mgsv
    - MYSQL_USER=mgsv_user
    - MYSQL_PASSWORD=mgsvpass
  ports:
    - "3306:3306"
  volumes:
    - ./mysql/:/docker-entrypoint-initdb.d

phpmyadmin:
  image: phpmyadmin/phpmyadmin
  restart: always
  links:
    - db
  ports:
    - 8183:80
  environment:
    PMA_USER: root
    PMA_PASSWORD: admin
    PMA_ARBITRARY: 1

先感谢您

相关内容