有一段时间后,我的nginx服务器会出现有关静态文件的错误,我在一台服务器中使用NGINX来提供静态文件,并在另一台服务器上使用Django应用程序的代理。
我将静态文件从Django服务器复制到NGINX服务器,然后运行#include <iostream>
#include <string>
#include <vtkUnstructuredGrid.h>
#include <vtkGenericDataObjectReader.h>
#include <vtkSmartPointer.h>
#include <vtkDelaunay2D.h>
#include <vtkProbeFilter.h>
#include <vtkPointData.h>
int main ()
{
std::string inputFilename = "data.vtk";
vtkSmartPointer<vtkGenericDataObjectReader> reader =
vtkSmartPointer<vtkGenericDataObjectReader>::New();
reader->SetFileName(inputFilename.c_str());
reader->Update();
vtkUnstructuredGrid* ugrid = reader->GetUnstructuredGridOutput();
int cell_no = ugrid->GetNumberOfCells();
//create structured grid
vtkSmartPointer<vtkPoints> grid_points = vtkSmartPointer<vtkPoints>::New();
int grid_size0 = 10;
int grid_size1 = 5;
double dx0 = .1;
double dx1 = .1;
for(int i = 0; i < grid_size0; ++i)
{
for(int j = 0; j < grid_size1; ++j)
{
grid_points->InsertNextPoint(i*dx0, j*dx1, 0);
}
}
//triangulate the grid points
vtkSmartPointer<vtkDelaunay2D> delaunay = vtkSmartPointer<vtkDelaunay2D>::New();
#if VTK_MAJOR_VERSION <= 5
delaunay->SetInput(ugrid);
#else
delaunay->SetInputData(ugrid);
#endif
delaunay->Update();
//create a dataset from the grid points
vtkSmartPointer<vtkPolyData> grid_poly_data = vtkSmartPointer<vtkPolyData>::New();
grid_poly_data->SetPoints(grid_points);
//perform the interpolation
vtkSmartPointer<vtkProbeFilter> probe_filter = vtkSmartPointer<vtkProbeFilter>::New();
probe_filter->SetSourceConnection(delaunay->GetOutputPort());
#if VTK_MAJOR_VERSION <= 5
probe_filter->SetInput(grid_poly_data);
#else
probe_filter->SetInputData(grid_poly_data);
#endif
probe_filter->Update();
vtkPolyData* spdata = probe_filter->GetPolyDataOutput();
vtkPointData* spoints = spdata->GetPointData();
std::cout << *probe_filter << std::endl;
std::cout << *spdata << std::endl;
std::cout << *spoints << std::endl;
return EXIT_SUCCESS;
}
命令。
error.log中
vtkProbeFilter (0x8a04d0)
Debug: Off
Modified Time: 621713
Reference Count: 2
Registered Events: (none)
Executive: 0x8a1280
ErrorCode: Success
Information: 0x8a0690
AbortExecute: Off
Progress: 1
Progress Text: (None)
Source: 0x89e4c0
SpatialMatch: Off
ValidPointMaskArrayName: vtkValidPointMask
ValidPoints: 0x8a0ed0
vtkPolyData (0x89a720)
Debug: Off
Modified Time: 621833
Reference Count: 1
Registered Events: (none)
Source: (none)
Information: 0x899810
Data Released: False
Global Release Data: Off
UpdateTime: 622378
Release Data: Off
UpdateExtent: Not Initialized
Update Number Of Pieces: 1
Update Piece: 0
Update Ghost Level: 0
MaximumNumberOfPieces: -1
RequestExactExtent: Off
Field Data:
Debug: Off
Modified Time: 621812
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 50
Number Of Cells: 0
Cell Data:
Debug: Off
Modified Time: 621820
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Point Data:
Debug: Off
Modified Time: 621833
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 1
Array 0 name = vtkValidPointMask
Number Of Components: 1
Number Of Tuples: 50
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Bounds:
Xmin,Xmax: (0, 0.9)
Ymin,Ymax: (0, 0.4)
Zmin,Zmax: (0, 0)
Compute Time: 622391
Number Of Points: 50
Point Coordinates: 0x8a1990
Locator: 0
Number Of Vertices: 0
Number Of Lines: 0
Number Of Polygons: 0
Number Of Triangle Strips: 0
Number Of Pieces: 1
Piece: 0
Ghost Level: 0
vtkPointData (0x89aab0)
Debug: Off
Modified Time: 621833
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 1
Array 0 name = vtkValidPointMask
Number Of Components: 1
Number Of Tuples: 50
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
nginx.conf
./manage.py collectstatic
站点启用/富
2016/12/07 20:36:17 [error] 26548#0: *1359 open() "/home/ws-admin/foo/media/branches/gmap__ndaUhjI.jpg" failed (2: No such file or directory), client: x.x.x.x, server: _, request: "GET /media/branches/gmap__ndaUhjI.jpg HTTP/1.1", host: "www.foo.com", referrer: "http://www.foo.com/"
2016/12/08 21:34:14 [error] 20474#0: *8608 open() "/home/ws-admin/foo/static/js/notify.js" failed (2: No such file or directory), client: x.x.x.x, server: _, request: "GET /static/js/notify.js HTTP/1.1", host: "www.foo.com", referrer: "http://www.foo.com/signup/"
settings.py
user ws-admin;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
# TCP/UDP proxy and load balancing block
#
#stream {
# Example configuration for TCP load balancing
#upstream stream_backend {
# zone tcp_servers 64k;
# server backend1.example.com:12345;
# server backend2.example.com:12345;
#}
#server {
# listen 12345;
# status_zone tcp_server;
# proxy_pass stream_backend;
#}
#}
答案 0 :(得分:0)
这意味着文件不存在或文件具有错误的权限。
检查文件是否存在:
ls -lah /home/ws-admin/foo/media/branches/gmap__ndaUhjI.jpg
ls -lah /home/ws-admin/foo/static/js/notify.js
根据需要更新权限
chown -R ws-admin: /home/ws-admin/foo/media
chown -R ws-admin: /home/ws-admin/foo/static