我成功地将Rails 5.1应用程序部署到EBS,而不是在<script>
var g;
function pic()
{
document.getElementById("aj").src = "g";
switch (g)
{
case 'aj':
alert("aj.jpg");
break;
case 'aj1':
alert("aj1.jpg");
break;
case 'aj2':
alert("aj2.jpg");
break;
}
}
</script>
目录中生成包文件。不知何故,我认为<div style="float:left; width:280px;">
<select class="input_select" onchange="pic('aj',this.value)">
<option value="o">select</option>
<option value="aj.jpg">aj</option>
<option value="aj1.jpg">ajl</option>
<option value="aj2.jpg">aj2</option>
</select>
</div>
<div style="float:left; width:280px; height:300px">
<img src="" width="300" height="300" id="aj">
</div>
需要配置为允许访问这些资源。目前,该应用程序可以访问位于此处的public
页面。
如何允许nginx
访问404
文件夹下的所有内容。以下是我使用的规则似乎不起作用:
nginx
对此有何帮助?
答案 0 :(得分:0)
如果您已成功部署rails应用程序并且它正在运行,那么我认为不需要提供对公用文件夹内容的访问。
默认情况下,它们由服务器提供。
如果您使用nginx和来宾根www.example.com
访问您的网站/var/app/current/public
您只需访问公用文件夹中的文件:
www.example.com/file_in_public_folder.ext
或
www.example.com/packs/any_path_to_file.ext
答案 1 :(得分:0)
如果您尝试在网站目录中显示文件(没有列出文档的HTML页面),您可以为该目录启用nginx autoindex。
http://nginx.org/en/docs/http/ngx_http_autoindex_module.html
# Allow browser to see files in directory
# Exact request URI matching
location = /var/www/path/ {
autoindex on;
}