我一直在這一點上,我顯然缺少一些簡單的東西。我有一個我正在爲nginx服務的Django應用程序。除了作爲TinyMCE HTML編輯器庫一部分的一些.htm文件外,應用程序中的所有其他靜態文件都可以正常使用。NGINX沒有提供htm文件,但提供所有其他靜態文件
不屬下的文件的路徑爲: http://www.myurl.org/static/admin/tinymce/jscripts/tiny_mce/plugins/advlink/link.htm/
nginx的日誌文件狀態的錯誤是: 「/家/部署/ CMP/CML /靜態/管理/ TinyMCE的/ jscripts/tiny_mce /插件/ advlink/link.htm/index.html的「未找到(20:不是一個目錄)」
(順便說一句,我不知道爲什麼nginx的不斷以爲文件路徑導致的目錄。)
但是,這個測試文件: http://www.myurl.org/static/admin/tinymce/jscripts/tiny_mce/plugins/advlink/tst.html 服務好。
我的配置文件是:MIME類型文件的
upstream app_server_wsgiapp {
server localhost:8000 fail_timeout=0;
}
server {
listen 80;
server_name XX.XXX.X.XX;
access_log /var/log/nginx/XX.XXX.X.XX.access.log;
error_log /var/log/nginx/XX.XXX.X.XX.error.log info;
keepalive_timeout 5;
#nginx serve up static files and never send to the WSGI server
location /static {
include /etc/nginx/mime.types;
autoindex on;
alias /home/deployer/cmp/cml/static;
}
location/{
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://app_server_wsgiapp;
break;
}
}
#this section allows Nginx to reverse proxy for websockets
location /socket.io {
proxy_pass http://app_server_wsgiapp/socket.io;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
相關部分:
types {
text/html html htm shtml;
text/css css;
text/xml xml rss;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
application/atom+xml atom;
...
}
任何建議得到被投放了link.htm?
更新:嘗試了幾件事後,我注意到nginx錯誤日誌說:「找不到/home/deployer/cmp/cml/static_proxy/index.html」,請求來自:「GET/static_proxy /?u = myurl.org/static/admin/tinymce/jscripts/tiny_mce/plugins/advlink/link.htm
(記錄中,這不是我的申請,我正在幫助老師朋友遷移關閉Gondor到Linode後,她的開發保釋。)
static_proxy來自tinymce lib。但是,這不是在我的機器上的開發問題,一切都很好,我嘗試添加這個位置塊,但那只是一個猜測而已。
location /static_proxy {
autoindex on;
root /home/deployer/cmp/cml;
}
如果我更改了上述根指令
alias /home/deployer/cmp/cml/static;
我得到了彈出,這似乎是一種改進的靜態目錄列表。
肯定的鏈接是錯誤的;它不應該有一個尾隨斜線。 –
當我嘗試加載沒有它的URL時,服務器會添加尾部斜槓。但是,如果我將文件擴展名更改爲.html而不是.htm,則文件加載得很好。 – OmahaJoe
那麼在/ home/deployer/cmp/cml/static/tinymce/jscripts/tiny_mce/plugins/advlink /'目錄中有哪些文件? –