CSS、JSなどに関して/ var/www/acmeに適用されるルールが/ var/www/acmeに適用されないように、Webサーバー上でNGINXルールの特別なディレクトリの上書きが必要です/特別。 me.com(127.0.0.1 localhost setup)の下に私のウェブサイトを含む/ var/wwwがあります。そこには、私のPHP用の特別なフレームワークを使用するacmeフォルダがあります。しかし、私は/ var/www/acme/specialというフォルダを用意しています。これらは同じ規則を適用せず、通常のPHP Webサイトと同じように実行する必要があります。/var/www/acme/specialのための特別な場所とtry_filesルーチンと、休憩と一緒にロジックを適用すると、内部的にリライトまたは内部リダイレクションサイクルと呼ばれるHTTP 500エラーが発生するため、 '/ acme/special //////////////'にリダイレクトされます。NGINXでディレクトリオーバーライド
私の/etc/nginx/sites-available/me.comファイルは、Ubuntu 16.04のNGINX用です。私は間違って何をしていますか?
server {
listen 80;
listen [::]:80;
root /var/www;
index index.php index.html;
server_name me.com www.me.com;
location /acme/special {
try_files $uri $uri/;
break;
}
location ~ ^/acme/(.*(?<!boot))/css/(.*)$ {
alias /var/www/acme/$1/views/assets/css/$2;
}
location ~ ^/acme/(.*(?<!boot))/js/(.*)$ {
alias /var/www/acme/$1/views/assets/js/$2;
}
location ~ ^/acme/(.*(?<!boot))/img/(.*)$ {
alias /var/www/acme/$1/views/assets/img/$2;
}
location ~ ^/acme/(.*)/fonts/(.*(?<!boot))$ {
alias /var/www/acme/$1/views/assets/fonts/$2;
}
location ~ ^/acme/(.*)/boot/(.*)$ {
alias /var/www/acme/$1/views/assets/boot/$2;
}
location/{
try_files $uri $uri/ @php;
}
location @php {
rewrite ^/acme/([^\/]+)/.*((?!index\.php).)*$ /acme/$1/index.php?query_string last;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}