私はDokkuと静的なサイトとして機能してきたスーパーシンプルなウェブサイトを持っています。Dokku静的サイトカスタムnginx設定
私は最近、dokku静的buildpackのnginxのデフォルト設定が、すべてのファイルをuriで利用可能にすることを認識しました。これをページの配信に必要なファイルだけに絞り込んでいます。
カスタムapp-nginx.conf.sigil
ファイルを作成しましたが(下記参照)、ビルド時にはドックによって無視されるようです。
すべてのファイルは、サイト上でまだ利用可能であり、私は私のnginxの設定に何か問題があると思い作りdokkuのビルド出力に2つのラインがあります。
がFYI - アプリ名は<app-name>
に置き換えられました
$> git push dokku master
Counting objects: 3, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 305 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
-----> Cleaning up...
-----> Building <app-name> from herokuish...
-----> Adding BUILD_ENV to build environment...
-----> .static app detected
-----> Copy static files to www
-----> Reusing nginx binary from cache
-----> Using user provided app-nginx.conf.sigil
-----> Using default app-nginx.conf.sigil
-----> Using default mime.types
-----> Discovering process types
Default types for -> web
-----> Releasing <app-name> (dokku/<app-name>:latest)...
-----> Deploying <app-name> (dokku/<app-name>:latest)...
-----> Attempting to run scripts.dokku.predeploy from app.json (if defined)
-----> App Procfile file found (/home/dokku/<app-name>/DOKKU_PROCFILE)
-----> DOKKU_SCALE file found (/home/dokku/<app-name>/DOKKU_SCALE)
=====> web=1
-----> Attempting pre-flight checks
For more efficient zero downtime deployments, create a file CHECKS.
See http://dokku.viewdocs.io/dokku/deployment/zero-downtime-deploys/ for examples
CHECKS file not found in container: Running simple container check...
-----> Waiting for 10 seconds ...
-----> Default container check successful!
-----> Running post-deploy
-----> Attempting to run scripts.dokku.postdeploy from app.json (if defined)
-----> Found previous container(s) (139a82449b6c) named <app-name>.web.1
=====> renaming container (139a82449b6c) <app-name>.web.1 to <app-name>.web.1.1485630818
=====> renaming container (37e990b5d729) mad_nobel to <app-name>.web.1
-----> Configuring <app-name>...(using built-in template)
-----> Creating https nginx.conf
-----> Running nginx-pre-reload
Reloading nginx
-----> Setting config vars
DOKKU_APP_RESTORE: 1
-----> Shutting down old containers in 60 seconds
=====> 139a82449b6c2642efb3a2f5706de93a2012003518461619ffdb37681c195906
=====> Application deployed:
http://<app-name>
https://<app-name>
To [email protected]<app-name>:<app-name>
f49a26d..90acc86 master -> master
面倒ラインはもちろんです:
-----> Using user provided app-nginx.conf.sigil
-----> Using default app-nginx.conf.sigil
そして、私のapp-nginx.conf.sigil
ファイル:私は何をしようとしている達成する方法について
worker_processes 1;
error_log stderr;
pid nginx.pid;
daemon off;
events {
worker_connections 768;
}
http {
types_hash_max_size 2048;
include mime.types;
server {
listen {{ $.PORT }};
server_name _;
{{ if ne $.NGINX_ROOT "" }}
root /app/www/{{ $.NGINX_ROOT }};
{{ else }}
root /app/www;
{{ end }}
index index.html;
location/{
try_files /index.html /favicon.ico /logo.png;
}
location /css/ {
try_files $uri;
}
}
}
任意の考え(唯一の私はそれがしたいファイルを提供するサーバーを制限しますか)?
ありがとうございます!
静的サイトPAASをDokkuと互換性を持たせたい場合は、https://github.com/pahaz/static-site-paas/を試してください。 – pahaz