의 nginx 버전을 작동하지 않는 것 :에는 OpenSSL 1.0.2g로 구축의 nginx/1.10.3 (우분투) 1 삼월 2016 TLS SNI 지원 을 통해 설치 가능 HTML5를 사용하여 를 apt-get을 기본으로 상용구 설정 프로젝트Nginx의 루트 지시어는
나는 간단한 작업을하려고 노력하고 있으며 생각했던 것처럼 작동하지 않습니다. 나는 디렉토리 구조과 같이 있습니다
/var/www$ tree
.
├── docroot
│ └── files
│ ├── booger.txt
│ └── favicon.ico
└── static
├── h5bp
│ ├── humans.txt
│ ├── js
│ │ ├── main.js
│ │ ├── plugins.js
│ │ └── vendor
│ │ ├── jquery-1.12.0.min.js
│ │ └── modernizr-2.8.3.min.js
│ ├── tile.png
│ └── tile-wide.png
내가 가장 좋은 방법은 docroot를/파일 서버 루트 (실제의 docroot)가 다음 정적 파일의 루트를 다시 정의 생각했다. 여기 내 기본 설정은에서의/etc/nginx를/사이트 이용 가능한 :
# Choose between www and non-www, listen on the *wrong* one and redirect to
# the right one -- http://wiki.nginx.org/Pitfalls#Server_Name
#
server {
listen [::]:80 default_server;
listen 80 default_server;
# listen on all hosts
server_name _;
# and redirect to the https host (declared below)
# avoiding http://www -> https://www -> https:// chain.
return 301 https://www.ubercode.io$request_uri;
}
server {
# listen [::]:443 ssl http2 accept_filter=dataready; # for FreeBSD
# listen 443 ssl http2 accept_filter=dataready; # for FreeBSD
listen [::]:443 ssl http2 deferred default_server; # for Linux
listen 443 ssl http2 deferred default_server; # for Linux
# listen [::]:443 ssl http2;
# listen 443 ssl http2;
# The host name to respond to
server_name www.ubercode.io;
include h5bp/directive-only/ssl.conf;
# root /var/www/docroot/files;
root /var/www;
index index.html index.htm index.nginx-debian.html;
# return forbidden for any php, asp, jsp, our .dt templates, or myadmin requests
# location ~ (\.dt$|myadmin|\.php$|\.jsp$|\.asmx$|\.asp$) {
# deny all;
# }
# location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
# expires 1d;
# }
# location ~* \.(pdf)$ {
# expires 5d;
# }
# static
location /static/ {
# root /var/www;
autoindex on;
# expires 1d;
}
location/{
alias /var/www/docroot/files;
autoindex on;
}
#Specify a charset
charset utf-8;
# Custom 404 page
error_page 404 /404.html;
# Include the basic h5bp config set
include h5bp/basic.conf;
}
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
# listen on the wrong host
server_name _;
include h5bp/directive-only/ssl.conf;
# and redirect to the non-www host (declared below)
return 301 https://www.ubercode.io$request_uri;
}
내가이 표시됩니다 같은 정적 파일이 작동하지만 루트에있는 별명이 그들이 던져으로 작동하지 않는 것 그것을 사용하는 경우 404. 만약/location과/var/www 서버 루트 밑의 별칭에 주석을 달고 다른 라인의 주석 처리를 제거하면 서버는 docroot/files 자산을 반환하지만 정적 파일은 반환하지 않습니다. 위치 블록 내부의 가장 중요한 루트가 작동하지 않는 것처럼 보입니다. 아무도 무슨 일이 일어날 지 설명하고 그것을 해결할 수있는 방향을 제시 할 수 있습니까?
그래서 위에서 말한 것은 정확히 사실이 아닙니다. 웬일인지, 브라우저에 booger.txt의 URL을 넣었을 때 결과는 나오지만 favicon.ico는 그렇지 않습니다. jpeg 및 html 파일로 테스트했지만 기쁨은 없습니다. 그러나 어떤 이유로 booger.txt 파일이 작동하지 않습니다. 어떤 아이디어? –