есть конфигурация nginx
server {
listen 80;
server_name client.test.domain;
charset utf-8;
root /var/www/_test.domain/client/;
index index.php index.html;
client_max_body_size 0;
location / {
#root /var/www/_test.domain/client/;
}
location /html {
#root /var/www/_test.domain/;
alias /var/www/_test.domain/html;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-www.sock;
#fastcgi_pass 127.0.0.1.:9000;
fastcgi_index index.php;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
include fastcgi_params;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME /var/www/_test.domain/client$fastcgi_script_name;
#fastcgi_param PHP_ADMIN_VALUE "open_basedir=/var/www:/tmp:/var/lib/sessions:/var/www/tmp:/var/www/log";
#include /etc/nginx/fastcgi_params;
}
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
# caching of files
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 14d;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
При такой конфигурации скрипты работают, при запросе client.test.domain/html/css/style.css
выдает 404 Not found
в логе nginx видно что файл ищет
"/var/www/_test.domain/client/html/css/style.css"
если же сделать так
#root /var/www/_test.domain/client/;
index index.php index.html;
client_max_body_size 0;
location / {
root /var/www/_test.domain/client/;
}
location /html {
#root /var/www/_test.domain/;
alias /var/www/_test.domain/html;
}
то он пытается найти файл в "/etc/nginx/html/html/css/style.css"
замена на root
тоже игнорируется.
я уже сломал весь мозг. Потому как в документации сказано что root
и alias
в location
должно работать.
но вот у меня не работает.(((
location /html/ { root /var/www/_test.domain; }