访问目录

时间:2016-05-14 10:27:13

标签: php nginx

我的服务器大致有这个树状结构:

www
 |-index.php
 |foo
   |-index.php
   |-bar.php

我可以访问/index.php,但访问//foo或其他任何内容都会产生403.我尝试了各种配置,但没有一个能正常工作。< / p>

我的nginx.conf文件:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;

    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    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/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    server {
        listen         80;
        server_name    localhost;
        root /var/www/html;

        location / {
            root      /var/www/html;
            #try_files $uri /index.php$is_args$args;
        }

        location ~ \.php$ {

            fastcgi_pass   web_fpm:9000;
            fastcgi_index index.php                                                                                                             
            fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name; 
            include        fastcgi_params;
        }
    }
}

如果我取消注释注释行,任何请求都会提供/index.php,所以这没有用。

1 个答案:

答案 0 :(得分:0)

我找到了解决方案:设置索引。这是片段:

cfg.CreateMap<Customer, Customer_>()
   .ForMember(dest => dest.FirstNam , opt => opt.MapFrom(src => src.FirstName))
   .ForMember(dest => dest.LastNam , opt => opt.MapFrom(src => src.LastName))