0

the server is running nginx.

The access to all files in /meins/mymail is possible, but why?

regards Daniel

This is my config:

server {

    # SSL configuration
    #
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    ssl_certificate /etc/letsencrypt/live/www..de/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/www..de/privkey.pem;

    root /var/www/www..de;

    index index.html index.php index.htm ;

    server_name www..de;

    location ~* /meins/mymail/
    {
            deny all;
    }


    location ~ \.php$
    {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$
    {
            expires 1M;
            access_log off;
            add_header Cache-Control "public";
    }

    location ~* \.(?:css|js)$
    {
            expires 1m;
            access_log off;
    }

    location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$
    {
            expires 1M;
            access_log off;
    }

    location /images
    {
            try_files $uri $uri/;
    }

    location /deins
    {
            try_files $uri $uri/ ;
    }

            location /
    {
            rewrite ^/([^/\.]+)/*([^/]*)/*([^/\.]*)/*.*$ /main.php?kkk=$1&aaa=$2&bbb=$3 last;
            rewrite ^.$ /main.php?kkk=Startseite last;
    }

}
  • If you use ^~ rather than ~* before /meins/mymail, to instruct it to match it as a prefix rather than a regex, but to not try any regexes if it matches, are you still able to access that dir? – JackW Dec 22 '16 at 15:21
  • location ^~ /meins/mymail/ { deny all; } – Lakatusch Dec 22 '16 at 15:25
  • ... also dont work... access is still possible – Lakatusch Dec 22 '16 at 15:27
  • Just to make sure, you have restarted nginx, you are accessing the page over https on port 443, there are no other config files with location blocks for https:443, and you are using the same domain name as in the config file, right? – JackW Dec 22 '16 at 15:47
  • JackW you are right... other configs have override my settings... now it works... – Lakatusch Dec 22 '16 at 23:39

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.