How to configure a Location directive in nginx to process example.com/ (any name)

1

I am setting up a site in nginx, in the folder of the site I have a file avatar.php, which given a request avatar.local / {username} returns the image associated with the username, the problem is how to configure in nginx that this url is resolved the way I want, this is the server block:

server {
    listen 80;
    root /usr/share/nginx/html/avatar;
    index avatar.php index.html index.htm index.nginx-debian.html;

    server_name www.avatar.local avatar.local *.avatar.local;

    error_log /var/log/nginx/avatar_error.log crit;
    access_log /var/log/nginx/avatar_access.log;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
    #
    #   # With php7.0-cgi alone:
    #   fastcgi_pass 127.0.0.1:9000;
    #   # With php7.0-fpm:
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny all;
    }
}

but when I try an avatar.local / manuel url it returns a 404 someone could help me how to solve this thanks

    
asked by Manuel 24.11.2017 в 17:06
source

0 answers