Estou tentando reescrever todos os arquivos após cdn.minora.me/forum/ para outro diretório:
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl on;
ssl_certificate /etc/nginx/ssl/minora.me.crt;
ssl_certificate_key /etc/nginx/ssl/minora.me.key;
root /srv/minora.me/webservices/cdn.minora.me;
index index.html index.htm index.php;
server_name cdn.minora.me;
location ~* \.(eot|ttf|woff|js|css|svg)$ {
add_header Access-Control-Allow-Origin *;
}
location /forum/(images|language|sounds|templates|uploads|vendor|src\/modules|nodebb\.min\.js(\.map)?|stylesheet\.css|admin\.css) {
alias /srv/minora.me/webservices/forum.minora.me/public/;
}
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm-cdn.minora.me.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Os arquivos que estou tentando acessar, por exemplo:
cdn.minora.me/forum/stylesheet.css
definitivamente existe, por exemplo, a folha de estilo acima pode ser encontrada no seguinte caminho no meu servidor
/srv/minora.me/webservices/forum.minora.me/public/stylesheet.css
.
Mas o nginx está transmitindo um erro 404 não encontrado quando tento acessar, por exemplo,
cdn.minora.me/forum/stylesheet.css
Parece que não usa a regra, aqui uma parte do log de erros do nginx:
2014/12/23 15:30:51 [error] 30277#0: *8 open() "/srv/minora.me/webservices/cdn.minora.me/forum/stylesheet.css" failed (2: No such file or directory), client: 141.101.105.127, server: cdn.minora.me, request: "GET /forum/stylesheet.css HTTP/1.1", host: "cdn.minora.me"
2014/12/23 15:30:53 [error] 30277#0: *9 open() "/srv/minora.me/webservices/cdn.minora.me/forum/stylesheet.css" failed (2: No such file or directory), client: 141.101.105.127, server: cdn.minora.me, request: "GET /forum/stylesheet.css HTTP/1.1", host: "cdn.minora.me"
2014/12/23 15:30:57 [error] 30277#0: *9 open() "/srv/minora.me/webservices/cdn.minora.me/forum/stylesheet.css" failed (2: No such file or directory), client: 141.101.105.127, server: cdn.minora.me, request: "GET /forum/stylesheet.css HTTP/1.1", host: "cdn.minora.me"
2014/12/23 15:31:14 [error] 30277#0: *23 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 141.101.93.222, server: img.minora.me, request: "HEAD /assets/loader/[email protected] HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-img.minora.me.sock:", host: "img.minora.me", referrer: "https://minora.me/"
2014/12/23 15:35:24 [error] 30281#0: *31 open() "/srv/minora.me/webservices/cdn.minora.me/forum/stylesheet.css" failed (2: No such file or directory), client: 141.101.105.127, server: cdn.minora.me, request: "GET /forum/stylesheet.css HTTP/1.1", host: "cdn.minora.me"
2014/12/23 15:35:26 [error] 30278#0: *43 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 141.101.105.168, server: cdn.minora.me, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-cdn.minora.me.sock:", host: "cdn.minora.me"
Também substituir root
por alias
não funciona. Alguém pode ajudar?