Apacheの前でリバースプロキシサーバーとしてnginxを実行します。 バックエンドのフロントエンドからアップロードされたファイルにアクセスする必要があるので、nginxサイトの設定でエイリアスを使用する方法ですが、バックエンドの静的ファイルはnginxが直接処理する必要があります。私はnginxに新しくなったので、静的ファイルを扱う私の部分的な設定です。エイリアス(/ images)も指定しましたが、2番目の条件で上書きされるため動作しません。 nginxがroot(バックエンドアプリ)の静的ファイルとフロントエンドアプリからアップロードしたファイルを処理するように、2つの条件をどのように組み合わせることができますか? Apacheの設定では、この問題のエイリアスが含まれていましたが、動作しますが、nginxは表示されません。エイリアスからrootとアップロードされたファイルから静的ファイルを提供するnginx
server {
listen 80;
root /var/www/website/backend/www;
# Add index.php to the list if you are using PHP
index index.html index.php index.htm;
server_name admin.website.com www.admin.website.com;
location/{
proxy_pass http://localhost:8080;
include /etc/nginx/proxy_params;
}
#The alias to handle uploaded files(.jpeg, .pdf) from frontend
location /images {
alias /var/www/website/frontend/www/images;
}
#let nginx handle static files from root
location ~* \.(js|css|jpg|jpeg|gif|png|svg|ico|pdf|html|htm)$ {
expires 30d;
}
.
.
.
}