E
E
Evgeny Ilin2012-03-30 11:56:59
PHP
Evgeny Ilin, 2012-03-30 11:56:59

Nginx + phpmyadmin = static not being returned?

Hey habr!
About statics in general, the question is hackneyed, there are many solutions. The problem is that I don’t get it from the screwed phpmyadmin, the static is given from the site itself.
config:

server {
        listen 80;
        root /home/user/www;
        index index.php index.html index.htm;
        include mime.types;
        server_namelocalhost;
        #location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to index.html
                #try_files $uri $uri/ /index.php;
        #}
         location ~* ^.+\.(htm|html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar |wav|bmp|rtf|js)$ {
                root /home/user/www/;
        }
        location ~* ^.+\.(htm|html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav |bmp|rtf|js)$ {
                root /usr/share/phpmyadmin/;
        }
         location ^~ /phpmyadmin {
          root /usr/share/phpmyadmin;
          index index.php;
          include fastcgi_params;
          fastcgi_pass 127.0.0.1:9000;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME /usr/share$fastcgi_script_name;
        }
        location ~ .php$ {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME /home/user/www/$fastcgi_script_name;
        }
        location ~ /\.ht {
                deny all;
        }
}

rights to subdirectories
[email protected]:~# ls -lA /usr/share/phpmyadmin/themes
total 8
drwxrwxrwx 4 www-data root 4096 Mar 29 19:49 darkblue_orange
drwxrwxrwx 4 www-data root 4096 Mar 29 19:50 original

Those. ip_site/print.css will return, and ip_site/phpmyadmin/print.css -> "access denied"
Ps
I know that I need to treat knowledge) as best I can for now)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Puma Thailand, 2012-03-30
@geirby

You have two identical locations, turn on common sense, knowledge is not needed here, transfer the folder from phpmyadmin to the site directory if you do not know how to modify nginx.

T
tFirma, 2012-03-30
@tFirma

I think the problem is here:

location ~* ^.+\.(htm|html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav |bmp|rtf|js)$ {
root /home/user/www/;
}
location ~* ^.+\.(htm|html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar| wav|bmp|rtf|js)$ {
root /usr/share/phpmyadmin/;
}

Because
To find a location that matches the query, the locations given by prefix strings (prefix locations) are first checked. Among them, the maximum match is searched. The regular expressions are then checked, in the order in which they appear in the configuration file. Regular expression checking stops after the first match, and the appropriate configuration is used. If a regular expression match is not found, then the configuration of the maximum matched prefix location is used.
nginx.org/ru/docs/http/ngx_http_core_module.html#location

Those. the second location is not processed at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question