我有一个小型网络应用程序,可以将文件上传到服务器,以便稍后显示在网络上。目前我的服务器硬盘几乎已满,我想添加第二个。目前该应用程序和所有现有文件都已打开drive1,我将添加drive2. 是否可以使用类似try_files检查多个位置来查看文件是否存在的方法?
例如,如果有人请求,mysite.com/images/2349879.jpgnginx 会首先查找/drive2/images/2349879.jpg,如果不存在,它会检查drive1/images/2349879.jpg,如果不存在,则提供 404?
这是我当前的 nginx.conf
server {
listen 80 default_server;
listen 443 ssl;
server_name www.MYSITE.com _;
ssl_certificate /srv/apps/MYSITE-ssl/certs/MYSITE.com.pem;
ssl_certificate_key /srv/apps/MYSITE-ssl/private/MYSITE.com.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers RC4:HIGH:!aNULL:!MD5:!kEDH;
ssl_prefer_server_ciphers on;
set $https off;
if ( $scheme = 'https' ) { set $https on; }
add_header Strict-Transport-Security "max-age=315360000; includeSubdomains";
keepalive_timeout 70;
return 301 $scheme://MYSITE.com$request_uri;
}
server {
listen 80;
listen 443 ssl;
server_name MYSITE.com;
ssl_certificate /srv/apps/MYSITE-ssl/certs/MYSITE.com.pem;
ssl_certificate_key /srv/apps/MYSITE-ssl/private/MYSITE.com.key; …Run Code Online (Sandbox Code Playgroud) nginx ×1