From 8918dce6d713d7059675a6ad114a3c981300681a Mon Sep 17 00:00:00 2001 From: Saki Yamamoto Date: Fri, 30 Aug 2019 09:48:43 +0800 Subject: [PATCH 1/5] comicomi --- ja/setup-installation.md | 102 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 ja/setup-installation.md diff --git a/ja/setup-installation.md b/ja/setup-installation.md new file mode 100644 index 00000000..5b2ba66d --- /dev/null +++ b/ja/setup-installation.md @@ -0,0 +1,102 @@ +# インストール + +- [システムの最低条件](#system-requirements) +- [インストーラを使ったインストール](#wizard-installation) + - [トラブルシューティング](#troubleshoot-installation) +- [コマンドラインを使ったインストール](#command-line-installation) +- [インストール後の手順](#post-install-steps) + - [インストールファイルの削除](#delete-install-files) + - [設定のレビュー](#config-review) + - [スケジューラーのセットアップ](#crontab-setup) + - [queue workersのセットアップ](#queue-setup) + +Octoberをインストールするには2つの方法があります。 [インストーラー](#wizard-installation) を使う方法か、 [コマンドラインでのインストール](../console/commands#console-install) の説明に沿ってインストールする方法があります。 インストールする前に、サーバが条件と合っているか確認してください。 + + +## システムの最低条件 + +October CMSには下記のウェブホスティングサーバが必要です。 + +1. PHP version 7.0 or higher +1. PDO PHP Extension +1. cURL PHP Extension +1. OpenSSL PHP Extension +1. Mbstring PHP Library +1. ZipArchive PHP Library +1. GD PHP Library + +PHP JSON と XML extensionsのインストールが必要なディストリビューションもあります。 例えば, when using Ubuntu this can be done via `apt-get install php7.0-json` and `apt-get install php7.0-xml` respectively. + +SQLサーバデータベースエンジンを使う場合は、[group concatenation](https://groupconcat.codeplex.com/)ユーザ定義集計?のインストールが必要です。 + + +## インストーラを使ったインストール + +Octorberをインストールするにはインストーラを使用するのが推奨されています。 コマンドラインを使ってインストールするよりもシンプルで、特別なスキルも必要ありません。 + +1. 空のサーバー上のディレクトリを準備してください。これがサブディレクトリ、ドメインルート、サブドメインになります。? +1. インストーラの圧縮ファイルを[ダウンロード](http://octobercms.com/download)します。 +1. 準備したディレクトリでインストーラの圧縮ファイルを解凍します。 +1. Grant writing permissions on the installation directory and all its subdirectories and files. +1. Navigate to the install.php script in your web browser. +1. Follow the installation instructions. + +![image](https://github.com/octobercms/docs/blob/master/images/wizard-installer.png?raw=true) {.img-responsive .frame} + + +### トラブルシューティング + +1. **An error 500 is displayed when downloading the application files**: You may need to increase or disable the timeout limit on your webserver. For example, Apache's FastCGI sometimes has the `-idle-timeout` option set to 30 seconds. + +1. **A blank screen is displayed when opening the application**: Check the permissions are set correctly on the `/storage` files and folders, they should be writable for the web server. + +1. **An error code "liveConnection" is displayed**: The installer will test a connection to the installation server using port 80. Check that your webserver can create outgoing connections on port 80 via PHP. Contact your hosting provider or this is often found in the server firewall settings. + +1. **The back-end area displays "Page not found" (404)**: If the application cannot find the database then a 404 page will be shown for the back-end. Try enabling [debug mode](../setup/configuration#debug-mode) to see the underlying error message. + +> **Note:** A detailed installation log can be found in the `install_files/install.log` file. + + +## Command-line installation + +If you feel more comfortable with a command-line or want to use composer, there is a CLI install process on the [Console interface page](../console/commands#console-install). + + +## Post-installation steps + +There are some things you may need to set up after the installation is complete. + + +### Delete installation files + +If you have used the [Wizard installer](#wizard-installation) you should delete the installation files for security reasons. October will never delete files from your system automatically, so you should delete these files and directories manually: + + install_files/ <== Installation directory + install.php <== Installation script + + +### Review configuration + +Configuration files are stored in the **config** directory of the application. While each file contains descriptions for each setting, it is important to review the [common configuration options](../setup/configuration) available for your circumstances. + +For example, in production environments you may want to enable [CSRF protection](../setup/configuration#csrf-protection). While in development environments, you may want to enable [bleeding edge updates](../setup/configuration#edge-updates). + +While most configuration is optional, we strongly recommend disabling [debug mode](../setup/configuration#debug-mode) for production environments. You may also want to use a [public folder](../setup/configuration#public-folder) for additional security. + + +### Setting up the scheduler + +For *scheduled tasks* to operate correctly, you should add the following Cron entry to your server. Editing the crontab is commonly performed with the command `crontab -e`. + + * * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1 + +Be sure to replace **/path/to/artisan** with the absolute path to the *artisan* file in the root directory of October. This Cron will call the command scheduler every minute. Then October evaluates any scheduled tasks and runs the tasks that are due. + +> **Note**: If you are adding this to `/etc/cron.d` you'll need to specify a user immediately after `* * * * *`. + + +### Setting up queue workers + +You may optionally set up an external queue for processing *queued jobs*, by default these will be handled asynchronously by the platform. This behavior can be changed by setting the `default` parameter in the `config/queue.php`. + +If you decide to use the `database` queue driver, it is a good idea to add a Crontab entry for the command `php artisan queue:work --once` to process the first available job in the queue. From a7f29d4563338c87b08f354eb122e042e98480bc Mon Sep 17 00:00:00 2001 From: Saki Yamamoto Date: Fri, 30 Aug 2019 13:03:42 +0800 Subject: [PATCH 2/5] comit --- ja/setup-installation.md | 57 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/ja/setup-installation.md b/ja/setup-installation.md index 5b2ba66d..b6a46591 100644 --- a/ja/setup-installation.md +++ b/ja/setup-installation.md @@ -6,9 +6,9 @@ - [コマンドラインを使ったインストール](#command-line-installation) - [インストール後の手順](#post-install-steps) - [インストールファイルの削除](#delete-install-files) - - [設定のレビュー](#config-review) + - [コンフィグレーションのレビュー](#config-review) - [スケジューラーのセットアップ](#crontab-setup) - - [queue workersのセットアップ](#queue-setup) + - [キューワーカーのセットアップ](#queue-setup) Octoberをインストールするには2つの方法があります。 [インストーラー](#wizard-installation) を使う方法か、 [コマンドラインでのインストール](../console/commands#console-install) の説明に沿ってインストールする方法があります。 インストールする前に、サーバが条件と合っているか確認してください。 @@ -25,9 +25,9 @@ October CMSには下記のウェブホスティングサーバが必要です。 1. ZipArchive PHP Library 1. GD PHP Library -PHP JSON と XML extensionsのインストールが必要なディストリビューションもあります。 例えば, when using Ubuntu this can be done via `apt-get install php7.0-json` and `apt-get install php7.0-xml` respectively. +PHP JSON と XML extensionsのインストールが必要なディストリビューションもあります。 例えばUbuntuの場合、それぞれ `apt-get install php7.0-json` と `apt-get install php7.0-xml` でインストールできます。 -SQLサーバデータベースエンジンを使う場合は、[group concatenation](https://groupconcat.codeplex.com/)ユーザ定義集計?のインストールが必要です。 +SQLサーバデータベースエンジンを使う場合は、[group concatenation](https://groupconcat.codeplex.com/)user-defined aggregateのインストールが必要です。 ## インストーラを使ったインストール @@ -37,66 +37,67 @@ Octorberをインストールするにはインストーラを使用するのが 1. 空のサーバー上のディレクトリを準備してください。これがサブディレクトリ、ドメインルート、サブドメインになります。? 1. インストーラの圧縮ファイルを[ダウンロード](http://octobercms.com/download)します。 1. 準備したディレクトリでインストーラの圧縮ファイルを解凍します。 -1. Grant writing permissions on the installation directory and all its subdirectories and files. -1. Navigate to the install.php script in your web browser. -1. Follow the installation instructions. +1. インストールディレクトリとそのすべてのサブディレクトリとファイルに対する書き込み権限を付与します。 +1. Webブラウザーでinstall.phpスクリプトに移動します。 +1. インストール手順に従って進めます。 ![image](https://github.com/octobercms/docs/blob/master/images/wizard-installer.png?raw=true) {.img-responsive .frame} ### トラブルシューティング -1. **An error 500 is displayed when downloading the application files**: You may need to increase or disable the timeout limit on your webserver. For example, Apache's FastCGI sometimes has the `-idle-timeout` option set to 30 seconds. +1. **アプリケーションファイルのダウンロード時にError 500が表示される**: Webサーバのタイムアウト時間を延長するか設定を無効にする必要があります。例えばApache's FastCGIでは `-idle-timeout` オプションが30秒に設定されていることがあります。 -1. **A blank screen is displayed when opening the application**: Check the permissions are set correctly on the `/storage` files and folders, they should be writable for the web server. +1. **アプリケーションを開いた時にブランクの画面が表示される**: `/storage`ファイルとフォルダはWebサーバーに対して書き込み可能である必要があるため、アクセス許可が正しく設定されているかを確認してください。 -1. **An error code "liveConnection" is displayed**: The installer will test a connection to the installation server using port 80. Check that your webserver can create outgoing connections on port 80 via PHP. Contact your hosting provider or this is often found in the server firewall settings. +1. **エラーコード"liveConnection"が表示される**: The installer will test a connection to the installation server using port 80. Check that your webserver can create outgoing connections on port 80 via PHP. Contact your hosting provider or this is often found in the server firewall settings.インストーラはポート80を使用してインストールサーバへの接続テストを行います。WebサーバーがPHP経由でポート80に接続できることを確認してください。サーバファイアウォールの設定でよく見られるため、 ホスティングプロバイダにお問い合わせください。 -1. **The back-end area displays "Page not found" (404)**: If the application cannot find the database then a 404 page will be shown for the back-end. Try enabling [debug mode](../setup/configuration#debug-mode) to see the underlying error message. +1. **バックエンドエリアに"Page not found" (404)と表示される**: アプリケーションがデータベースを見つけることができない場合に、バックエンドの404ページが表示されます。[デバックモード](../setup/configuration#debug-mode)を有効にして、もととなっているエラーメッセージを確認してください。 -> **Note:** A detailed installation log can be found in the `install_files/install.log` file. +> **備考:** インストールログの詳細は `install_files/install.log` ファイルにあります。 -## Command-line installation +## コマンドラインを使ったインストール -If you feel more comfortable with a command-line or want to use composer, there is a CLI install process on the [Console interface page](../console/commands#console-install). +コマンドラインを使い慣れている、または、コンポーザを使いたい場合は、 [コンソールインターフェースページ](../console/commands#console-install)にCLIのインストール手順があります。 -## Post-installation steps +## インストール後の手順 -There are some things you may need to set up after the installation is complete. +インストール完了後に、いくつかの設定が必要な場合があります。 -### Delete installation files +### インストールファイルの削除 -If you have used the [Wizard installer](#wizard-installation) you should delete the installation files for security reasons. October will never delete files from your system automatically, so you should delete these files and directories manually: +[インストーラ](#wizard-installation)を使用した場合、セキュリティ上の理由からインストールファイルを削除してください。Octorberは自動的にファイルを削除しないため、下記のファイルとディレクトリを手動で削除してくださ。 install_files/ <== Installation directory install.php <== Installation script -### Review configuration +### コンフィグレーションのレビュー -Configuration files are stored in the **config** directory of the application. While each file contains descriptions for each setting, it is important to review the [common configuration options](../setup/configuration) available for your circumstances. +コンフィグレーションファイルは、アプリケーションの **config** ディレクトリに保存されます。各ファイルには各設定についての説明が含まれていますが、状況に応じて利用可能な[一般的なコンフィグレーションのオプション](../setup/configuration)を確認することが重要です。 -For example, in production environments you may want to enable [CSRF protection](../setup/configuration#csrf-protection). While in development environments, you may want to enable [bleeding edge updates](../setup/configuration#edge-updates). +例えば、本番環境では [CSRF 保護](../setup/configuration#csrf-protection)を有効にすることができ、開発環境では [最新版への更新](../setup/configuration#edge-updates)を有効にすることができます。 -While most configuration is optional, we strongly recommend disabling [debug mode](../setup/configuration#debug-mode) for production environments. You may also want to use a [public folder](../setup/configuration#public-folder) for additional security. +ほとんどの設定はオプションですが、本番環境では[デバックモード](../setup/configuration#debug-mode) を無効にすることを強くお勧めします。 セキュリティ強化のために[パブリックフォルダ](../setup/configuration#public-folder) の使用も可能です。 -### Setting up the scheduler +### スケジューラーのセットアップ For *scheduled tasks* to operate correctly, you should add the following Cron entry to your server. Editing the crontab is commonly performed with the command `crontab -e`. +*スケジジュールされたタスク* が正しく動作するには、次のCronエントリをサーバーに追加する必要があります。 Cronタブの編集は、一般的にコマンド `crontab -e`で実行されます。 * * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1 -Be sure to replace **/path/to/artisan** with the absolute path to the *artisan* file in the root directory of October. This Cron will call the command scheduler every minute. Then October evaluates any scheduled tasks and runs the tasks that are due. +必ず **/path/to/artisan** を、Octorberのルートディレクトリにある *artisan* ファイルへの絶対パスに置き換えてください。このCronは毎分コマンドスケジューラーをコールします。そしてスケジュールされたタスクを算定して、期限のあるタスクを実行します。 -> **Note**: If you are adding this to `/etc/cron.d` you'll need to specify a user immediately after `* * * * *`. +> **備考**: これを `/etc/cron.d` に追加する場合、`* * * * *`のすぐ後にユーザを指定する必要があります。 -### Setting up queue workers +### キューワーカーのセットアップ -You may optionally set up an external queue for processing *queued jobs*, by default these will be handled asynchronously by the platform. This behavior can be changed by setting the `default` parameter in the `config/queue.php`. +*queued jobs* を処理するための外部キューをオプションで設定できます。デフォルトでは、これらはプラットフォームによって非同期的に処理されます。 この動作は`config/queue.php`の`default`のパラメーターを設定することで変更できます。 -If you decide to use the `database` queue driver, it is a good idea to add a Crontab entry for the command `php artisan queue:work --once` to process the first available job in the queue. +`database`キュードライバーを使用する場合、キューで始めに使用可能なジョブを処理するために、コマンド`php artisan queue:work --once`のためのCrontタブエントリの追加をお勧めします。 From 40355b0e523f7fe09bf43855b6f9d45f9f189319 Mon Sep 17 00:00:00 2001 From: Saki Yamamoto Date: Fri, 6 Sep 2019 15:34:17 +0800 Subject: [PATCH 3/5] commit --- ja/setup-installation.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ja/setup-installation.md b/ja/setup-installation.md index b6a46591..1ac294fb 100644 --- a/ja/setup-installation.md +++ b/ja/setup-installation.md @@ -25,7 +25,7 @@ October CMSには下記のウェブホスティングサーバが必要です。 1. ZipArchive PHP Library 1. GD PHP Library -PHP JSON と XML extensionsのインストールが必要なディストリビューションもあります。 例えばUbuntuの場合、それぞれ `apt-get install php7.0-json` と `apt-get install php7.0-xml` でインストールできます。 +PHP JSON と XML extensionsのインストールが必要なディストリビューションもあります。例えばUbuntuの場合、それぞれ `apt-get install php7.0-json` と `apt-get install php7.0-xml` でインストールできます。 SQLサーバデータベースエンジンを使う場合は、[group concatenation](https://groupconcat.codeplex.com/)user-defined aggregateのインストールが必要です。 @@ -34,7 +34,7 @@ SQLサーバデータベースエンジンを使う場合は、[group concatenat Octorberをインストールするにはインストーラを使用するのが推奨されています。 コマンドラインを使ってインストールするよりもシンプルで、特別なスキルも必要ありません。 -1. 空のサーバー上のディレクトリを準備してください。これがサブディレクトリ、ドメインルート、サブドメインになります。? +1. 空のサーバー上のディレクトリを準備してください。これがサブディレクトリ、ドメインルート、サブドメインになります。 1. インストーラの圧縮ファイルを[ダウンロード](http://octobercms.com/download)します。 1. 準備したディレクトリでインストーラの圧縮ファイルを解凍します。 1. インストールディレクトリとそのすべてのサブディレクトリとファイルに対する書き込み権限を付与します。 @@ -50,7 +50,7 @@ Octorberをインストールするにはインストーラを使用するのが 1. **アプリケーションを開いた時にブランクの画面が表示される**: `/storage`ファイルとフォルダはWebサーバーに対して書き込み可能である必要があるため、アクセス許可が正しく設定されているかを確認してください。 -1. **エラーコード"liveConnection"が表示される**: The installer will test a connection to the installation server using port 80. Check that your webserver can create outgoing connections on port 80 via PHP. Contact your hosting provider or this is often found in the server firewall settings.インストーラはポート80を使用してインストールサーバへの接続テストを行います。WebサーバーがPHP経由でポート80に接続できることを確認してください。サーバファイアウォールの設定でよく見られるため、 ホスティングプロバイダにお問い合わせください。 +1. **エラーコード"liveConnection"が表示される**: インストーラはポート80を使用してインストールサーバへの接続テストを行います。WebサーバーがPHP経由でポート80に接続できることを確認してください。サーバファイアウォールの設定でよく見られるため、 ホスティングプロバイダにお問い合わせください。 1. **バックエンドエリアに"Page not found" (404)と表示される**: アプリケーションがデータベースを見つけることができない場合に、バックエンドの404ページが表示されます。[デバックモード](../setup/configuration#debug-mode)を有効にして、もととなっているエラーメッセージを確認してください。 @@ -77,7 +77,7 @@ Octorberをインストールするにはインストーラを使用するのが ### コンフィグレーションのレビュー -コンフィグレーションファイルは、アプリケーションの **config** ディレクトリに保存されます。各ファイルには各設定についての説明が含まれていますが、状況に応じて利用可能な[一般的なコンフィグレーションのオプション](../setup/configuration)を確認することが重要です。 +コンフィグレーションファイルは、アプリケーションの **config** ディレクトリに保存されます。各ファイルには各設定についての説明が含まれていますが、状況に応じて利用可能な[一般的な設定オプション](../setup/configuration)を確認することが重要です。 例えば、本番環境では [CSRF 保護](../setup/configuration#csrf-protection)を有効にすることができ、開発環境では [最新版への更新](../setup/configuration#edge-updates)を有効にすることができます。 @@ -86,8 +86,7 @@ Octorberをインストールするにはインストーラを使用するのが ### スケジューラーのセットアップ -For *scheduled tasks* to operate correctly, you should add the following Cron entry to your server. Editing the crontab is commonly performed with the command `crontab -e`. -*スケジジュールされたタスク* が正しく動作するには、次のCronエントリをサーバーに追加する必要があります。 Cronタブの編集は、一般的にコマンド `crontab -e`で実行されます。 +*スケジジュールされたタスク* が正しく動作するには、次のCronエントリをサーバーに追加する必要があります。 Crontabの編集は、一般的にコマンド `crontab -e`で実行されます。 * * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1 @@ -100,4 +99,4 @@ For *scheduled tasks* to operate correctly, you should add the following Cron en *queued jobs* を処理するための外部キューをオプションで設定できます。デフォルトでは、これらはプラットフォームによって非同期的に処理されます。 この動作は`config/queue.php`の`default`のパラメーターを設定することで変更できます。 -`database`キュードライバーを使用する場合、キューで始めに使用可能なジョブを処理するために、コマンド`php artisan queue:work --once`のためのCrontタブエントリの追加をお勧めします。 +`database`キュードライバーを使用する場合、`php artisan queue:work --once`コマンドをCrontabに追加して、キュー内のジョブを1つずつ処理することをお勧めします。 From 4d7724b32129e7935623fdc654b6fd8bf803ad7b Mon Sep 17 00:00:00 2001 From: Saki Yamamoto Date: Fri, 6 Sep 2019 17:48:31 +0800 Subject: [PATCH 4/5] commit --- ja/setup-configuration.md | 295 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 295 insertions(+) create mode 100644 ja/setup-configuration.md diff --git a/ja/setup-configuration.md b/ja/setup-configuration.md new file mode 100644 index 00000000..701f6fee --- /dev/null +++ b/ja/setup-configuration.md @@ -0,0 +1,295 @@ +# App 設定 + +- [Websサーバ設定](#webserver-configuration) + - [Apache設定](#apache-configuration) + - [Nginx設定](#nginx-configuration) + - [Lighttpd設定](#lighttpd-configuration) + - [IIS設定](#iis-configuration) +- [アプリケーション設定](#app-configuration) + - [デバッグモード](#debug-mode) + - [セーフモード](#safe-mode) + - [CSRF保護](#csrf-protection) + - [最新版のアップデート](#edge-updates) + - [パブリックフォルダの使用](#public-folder) +- [環境構築](#environment-config) + - [基本環境の定義](#base-environment) + - [ドメイン駆動環境](#domain-environment) + - [DotEnv環境への変換](#dotenv-configuration) + +Octoberの全てのコンフィグファイルは **config/** ディレクトリに保存されています。各オプションはドキュメント化されているので、ご自由に目を通して、利用可のなオプションに慣れてください。 + + +## Webサーバ設定 + +OctorberにはWebサーバに適用されている基本設定があります。一般的なサーバとその設定は下記になります。 + + +### Apache設定 + +Apacheを使用している場合、下記の追加が必要です: + +1. mod_rewriteをインストールしてください +1. AllowOverrideオプションをオンにしてください + +`.htaccess`ファイルの下記コメントを外す必要がある場合があります: + + ## + ## You may need to uncomment the following line for some hosting environments, + ## if you have installed to a subdirectory, enter the name here also. + ## + # RewriteBase / + +サブディレクトリをインストールしている場合は、サブディレクトリの名前の追加も必要です: + + RewriteBase /mysubdirectory/ + + +### Nginx設定 + +Nginxで設定するには少しだけ設定が必要です。 + +`nano /etc/nginx/sites-available/default` + +下記コードを **server** セクションで使用してください。Octorberをサブディレクトリにインストールしている場合は、ロケーションディレクティブの最初の `/` をOctorberがインストールされているディレクトリに置き換えてください: + + location / { + # Let OctoberCMS handle everything by default. + # The path not resolved by OctoberCMS router will return OctoberCMS's 404 page. + # Everything that does not match with the whitelist below will fall into this. + rewrite ^/.*$ /index.php last; + } + + # Pass the PHP scripts to FastCGI server + location ~ ^/index.php { + # Write your FPM configuration here + + } + + # Whitelist + ## Let October handle if static file not exists + location ~ ^/favicon\.ico { try_files $uri /index.php; } + location ~ ^/sitemap\.xml { try_files $uri /index.php; } + location ~ ^/robots\.txt { try_files $uri /index.php; } + location ~ ^/humans\.txt { try_files $uri /index.php; } + + ## Let nginx return 404 if static file not exists + location ~ ^/storage/app/uploads/public { try_files $uri 404; } + location ~ ^/storage/app/media { try_files $uri 404; } + location ~ ^/storage/temp/public { try_files $uri 404; } + + location ~ ^/modules/.*/assets { try_files $uri 404; } + location ~ ^/modules/.*/resources { try_files $uri 404; } + location ~ ^/modules/.*/behaviors/.*/assets { try_files $uri 404; } + location ~ ^/modules/.*/behaviors/.*/resources { try_files $uri 404; } + location ~ ^/modules/.*/widgets/.*/assets { try_files $uri 404; } + location ~ ^/modules/.*/widgets/.*/resources { try_files $uri 404; } + location ~ ^/modules/.*/formwidgets/.*/assets { try_files $uri 404; } + location ~ ^/modules/.*/formwidgets/.*/resources { try_files $uri 404; } + location ~ ^/modules/.*/reportwidgets/.*/assets { try_files $uri 404; } + location ~ ^/modules/.*/reportwidgets/.*/resources { try_files $uri 404; } + + location ~ ^/plugins/.*/.*/assets { try_files $uri 404; } + location ~ ^/plugins/.*/.*/resources { try_files $uri 404; } + location ~ ^/plugins/.*/.*/behaviors/.*/assets { try_files $uri 404; } + location ~ ^/plugins/.*/.*/behaviors/.*/resources { try_files $uri 404; } + location ~ ^/plugins/.*/.*/reportwidgets/.*/assets { try_files $uri 404; } + location ~ ^/plugins/.*/.*/reportwidgets/.*/resources { try_files $uri 404; } + location ~ ^/plugins/.*/.*/formwidgets/.*/assets { try_files $uri 404; } + location ~ ^/plugins/.*/.*/formwidgets/.*/resources { try_files $uri 404; } + location ~ ^/plugins/.*/.*/widgets/.*/assets { try_files $uri 404; } + location ~ ^/plugins/.*/.*/widgets/.*/resources { try_files $uri 404; } + + location ~ ^/themes/.*/assets { try_files $uri 404; } + location ~ ^/themes/.*/resources { try_files $uri 404; } + + +### Lighttpd設定 + +Lighttpdを使用している場合、下記設定を使用することができます。お好きなエディターでコンフィグファイルを開いてください。 + +`nano /etc/lighttpd/conf-enabled/sites.conf` + +下記コードをエディターに貼り付け、 **host address** と **server.document-root** をプロジェクトに合うように変更してください。 + + $HTTP["host"] =~ "domain.example.com" { + server.document-root = "/var/www/example/" + + url.rewrite-once = ( + "^/(plugins|modules/(system|backend|cms))/(([\w-]+/)+|/|)assets/([\w-]+/)+[-\w^&'@{}[\],$=!#().%+~/ ]+\.(jpg|jpeg|gif|png|svg|swf|avi|mpg|mpeg|mp3|flv|ico|css|js|woff|ttf)(\?.*|)$" => "$0", + "^/(system|themes/[\w-]+)/assets/([\w-]+/)+[-\w^&'@{}[\],$=!#().%+~/ ]+\.(jpg|jpeg|gif|png|svg|swf|avi|mpg|mpeg|mp3|flv|ico|css|js|woff|ttf)(\?.*|)$" => "$0", + "^/storage/app/uploads/public/[\w-]+/.*$" => "$0", + "^/storage/temp/public/[\w-]+/.*$" => "$0", + "^/(favicon\.ico|robots\.txt|sitemap\.xml)$" => "$0", + "(.*)" => "/index.php$1" + ) + } + + +### IIS設定 + +Internet Information Services (IIS)を使用している場合、 **web.config** コンフィグファイルで下記を使用することができます。 + + + + + + + + + + + + + + + + + + + + + + + + + + +## アプリケーション設定 + + +### デバッグモード + +デバッグの設定は `config/app.php` コンフィグファイルの `debug` パラメータにあり、デフォルトで有効になっています。 + +この設定を有効にすると、他のデバッグ機能とともに発生した詳細なエラーメッセージが表示されます。 開発中は便利ですが、実際の運用サイトで使用する場合は、デバッグモードを常に無効にする必要があります。 これにより、潜在的な機密情報がエンドユーザーに表示されるのを防ぎます。 + +デバッグモード有効時は下記機能を使用します: + +1. [詳細エラーページ](../cms/pages#error-page)が表示されます +1. ユーザ認証失敗には特定の理由を提示します +1. [結合されたアセット](../markup/filter-theme)はデフォルトでは縮小されません +1. [セーフモード](#safe-mode)はデフォルトで無効になっています + +> **重要**: 本番環境では、常に `app.debug`設定を` false`に設定してください。 + + +### セーフモード + +セーフモードの設定は `config/cms.php` コンフィグファイル `enableSafeMode` パラメータにあり、デフォルト値は `null`になっています。 + +セーフモードが有効になっている場合、セキュリティ上の理由から、CMSテンプレートのPHPコードセクションは無効になっています。 `null`に設定すると、[デバッグモード](#debug-mode)が無効になっているときにセーフモードがオンになります。 + + +### CSRF保護 + +Octorberはクロスサイトリクエストフォージェリ(CSRF)からアプリケーションを保護する簡単な方法を提供しています。まず、ユーザーセッションにランダムトークンが配置されます。 次に[opening form tagが使用される](../services/html#form-tokens)と、トークンがページに追加され、各リクエストで送信されます。 + +CSRF保護はデフォルトで有効になっていますが、 `config/cms.php`コンフィグファイルの `enableCsrfProtection`パラメータで無効にできます。 + + +### 最新版のアップデート + +Octorberプラットフォームと一部のマーケットプレイスプラグインは、プラットフォームの全体的な安定性と整合性を確保するために2段階で変更を実装します。 つまりデフォルトの *stable build* に加えて *test build* があるということです。 + +`config / cms.php`設定ファイルの` edgeUpdates`パラメーターを変更することで、マーケットプレイスからのtest buildを優先するようにプラットフォームに指示できます。 + + /* + |-------------------------------------------------------------------------- + | Bleeding edge updates + |-------------------------------------------------------------------------- + | + | If you are developing with October, it is important to have the latest + | code base, set this value to 'true' to tell the platform to download + | and use the development copies of core files and plugins. + | + */ + + 'edgeUpdates' => false, + +> **備考:** プラグインディベロッパーの場合、プラグイン設定ページから、マーケットプレイスにリストされているプラグインの **Test updates** を有効にすることをお勧めします。 + +> **備考:** [Composer](../console/commands#console-install-composer) を使用してアップデート管理をする場合は、開発ブランチから直接アップデートをダウンロードするために、 `composer.json`ファイルのデフォルトのOctoberCMS要件を下記のように置き換えてください。 + + "october/rain": "dev-develop as 1.0", + "october/system": "dev-develop", + "october/backend": "dev-develop", + "october/cms": "dev-develop", + "laravel/framework": "5.5.*@dev", + + +### パブリックフォルダの使用 + +本番環境での最高のセキュリティのために、 **public/** フォルダーを使用してパブリックファイルのみにアクセスできるようにWebサーバーを設定できます。 最初に、 `october:mirror`コマンドを使用してパブリックフォルダーを生成する必要があります。 + + php artisan october:mirror public/ + +これにより、プロジェクトの基本のディレクトリに **public/** という新しいディレクトリが作成されます。ここから、この新しいパスを *wwwroot* と呼ばれるホームディレクトリとして使用するようにWebサーバー設定を修正する必要があります。 + +> **備考**: 上記のコマンドは、システム管理者または *sudo* 権限で実行する必要がある場合があります。 また、各システムの更新後、または新しいプラグインがインストールされたときに実行する必要があります。 + + +## 環境構築 + + +### 基本環境の定義 + +多くの場合、アプリケーション実行中の環境に基づいて異なる設定値を使用すると便利です。そのためにはデフォルトで **production** に設定されている `APP_ENV`環境変数を設定します。 この値を変更するには、2つの一般的な方法があります: + +1. Webサーバで直接 `APP_ENV` 値を設定します。 + + 例えばApacheでは、この行を `.htaccess` または `httpd.config` ファイルに追加することができます: + + SetEnv APP_ENV "dev" + +2. 下記内容の **.env** ファイルをルートフォルダに作成する: + + APP_ENV=dev + +上記の両例では、環境は新しい値 `dev`に設定されます。コンフィグファイルは **config/dev** で作成され、アプリケーションの基本設定はオーバーライドされます。 + +例えば `dev`環境でのみ異なるMySQLデータベースを使用するには、下記内容を使用した **config / dev / database.php** というファイルを作成します。: + + [ + 'mysql' => [ + 'host' => 'localhost', + 'port' => '', + 'database' => 'database', + 'username' => 'root', + 'password' => '' + ] + ] + ]; + + +### ドメイン駆動環境 + +Octoberは、特定のホスト名によって検出された環境の使用をサポートしています。 これらのホスト名は、環境設定ファイル、例えば **config / environment.php** に配置できます。 + +以下のこのファイルの内容を使用すると、 **global.website.tld** を介してアプリケーションにアクセスした時、環境は `global`に設定され、他の環境も同様に設定されます。 + + [ + 'global.website.tld' => 'global', + 'local.website.tld' => 'local', + ] + ]; + + +### DotEnv環境への変換 + +[基本環境設定](#base-environment) の代替として、コンフィグファイルを使用する代わりに、環境に共通の値を配置できます。 次に、 [DotEnv](https://github.com/vlucas/phpdotenv) 構文を使用してコンフィグにアクセスします。 `october:env`コマンドを実行して、一般的な設定値を環境に移動します: + + php artisan october:env + +これにより、プロジェクトのルートディレクトリに **.env** ファイルが作成され、 `env`ヘルパー関数を使用するようにコンフィグファイルが変更されます。 最初の実引数には環境で見つかったキー名が含まれ、2番目の実引数にはオプションのデフォルト値が含まれます。 + + 'debug' => env('APP_DEBUG', true), + +アプリケーションを使用するディベロッパーやサーバーごとに異なる環境設定が必要になる可能性があるため、 `.env`ファイルをアプリケーションのソース管理にコミットしないでください。 + +`.env`ファイルが本番環境で一般に非公開であることも重要です。 これを実現するには、[パブリックフォルダ](#public-folder)の使用を検討する必要があります From 6e617bd5839211e23db6e24c6ab30e89987f62f7 Mon Sep 17 00:00:00 2001 From: Saki Yamamoto Date: Fri, 25 Oct 2019 14:00:33 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E3=83=86=E3=83=BC=E3=83=9E=E7=B5=82?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ja/cms-themes.md | 174 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 ja/cms-themes.md diff --git a/ja/cms-themes.md b/ja/cms-themes.md new file mode 100644 index 00000000..4355c1da --- /dev/null +++ b/ja/cms-themes.md @@ -0,0 +1,174 @@ +# CMS テーマ + +- [導入](#introduction) +- [ディレクトリ構造](#directory-structure) + - [サブディレクトリ](#subdirectories) +- [テンプレート構造](#template-structure) + - [設定セクション](#configuration-section) + - [PHPコードセクション](#php-section) + - [Twigマークアップセクション](#twig-section) +- [テーマ ロギング](#theme-logging) + + +## 導入 + +テーマは、Octoberで構築されたWebサイトまたはWebアプリケーションの見た目を定義します。Octoberのテーマは完全にファイルベースで、例えばGitのどのバージョンでも管理されています。このページはOctoberテーマについてのハイレベル説明書です。 [ページ](pages)、[パーシャル](partials)、[レイアウト](layouts)、[コンテンツファイル](content)の詳細は該当記事をご覧ください。 + +テーマは初期設定で **/themes** に属するディレクトリです。テーマは下記のオブジェクトを含みます: + +オブジェクト | 説明 +------------- | ------------- +[ページ](pages) | webサイトのページを意味する +[パーシャル](partials) | 再利用可能なHTMLマークアップのチャンクを含む +[レイアウト](layouts) | スキャホールドページを定義する. +[コンテンツファイル](content) | ページやレイアウトとは別に編集できるtext、HTML、[マークダウン](http://daringfireball.net/projects/markdown/syntax)ブロック +**アセットファイル** | images、CSS、JavaScriptの様なリソースファイル + + +## ディレクトリ構造 + +下記がテーマディレクトリ構造の例です。Octoberの各テーマは個別のディレクトリで表され、通常1つのアクティブなテーマがWebサイトの表示に使用されます。この例は"website"テーマディレクトリを表示しています。. + + themes/ + website/ <=== Theme starts here + pages/ <=== Pages directory + home.htm + layouts/ <=== Layouts directory + default.htm + partials/ <=== Partials directory + sidebar.htm + content/ <=== Content directory + intro.htm + assets/ <=== Assets directory + css/ + my-styles.css + js/ + images/ + +> アクティブなテーマは `config/cms.php` ファイルにある `activeTheme` パラメータで設定される。もしくは、バックエンドページにある設定>CMS>フロントエンドのテーマで設定される。 + + +### サブディレクトリ + +Octoberでは **ページ**、**パーシャル**、**レイアウト**、**コンテンツ** ファイルの一階層のサブディレクトリをサポートしていますが、**assets** ディレクトリは任意の構造を持っています。 これは広大なWebサイトの構成を簡易化しています。下記のディレクトリ構造の例では、**pages** と **partials** ディレクトリには **blog** サブディレクトリが含まれていて、**content** ディレクトリには **home** サブディレクトリが含まれています。 + + themes/ + website/ + pages/ + home.htm + blog/ <=== Subdirectory + archive.htm + category.htm + partials/ + sidebar.htm + blog/ <=== Subdirectory + category-list.htm + content/ + footer-contacts.txt + home/ <=== Subdirectory + intro.htm + ... + +サブディレクトリからパーシャルファイルまたはコンテンツファイルを参照するには、テンプレートの名前の前にサブディレクトリの名前を指定します。 サブディレクトリからパーシャルをレンダリングする例: + + {% partial "blog/category-list" %} + +> **備考:** テンプレートのパスは常に絶対です。 パーシャルで同じサブディレクトリから別のパーシャルをレンダリングする場合、サブディレクトリの名前を指定する必要があります。 + + +## テンプレート構造 + +ページ、パーシャル、レイアウトテンプレートには最大3つのセクションを含めることができます: **設定**、**PHPコード**、**Twigマークアップ** + +セクションは `==`シーケンスで区切られます。 +例えば: + + url = "/blog" + layout = "default" + == + function onStart() + { + $this['posts'] = ...; + } + == +

Blog archive

+ {% for post in posts %} +

{{ post.title }}

+ {{ post.content }} + {% endfor %} + + +### 設定セクション + +設定セクションはパラメータのテンプレートを設定しています。サポートされている設定パラメーターは、さまざまなCMSテンプレート固有のものであり、対応するドキュメント記事で説明されています。設定セクションでは、文字列パラメーター値が引用符で囲まれているシンプルな[INIフォーマット](http://en.wikipedia.org/wiki/INI_file)を使っています。ページテンプレートの設定セクションの例: + + url = "/blog" + layout = "default" + + [component] + parameter = "value" + + +### PHPコードセクション + +PHPセクションのコードは、テンプレートがレンダリングされる前に毎回実行されます。PHPセクションはすべてのCMSテンプレートのためのオプションであり、その内容は定義されているテンプレートタイプによって異なります。PHPコードセクションは、テキストエディターで構文のハイライトを有効にするための開始および終了PHPタグをオプションで含んでいます。開始タグと終了タグは、常にセクションを区切る記号 `==`とは異なる行で指定する必要があります。 + + url = "/blog" + layout = "default" + == + + == +

Blog archive

+ {% for post in posts %} +

{{ post.title }}

+ {{ post.content }} + {% endfor %} + +PHPセクションでは、関数を定義し、PHPの `use`キーワードで名前空間を参照することしかできません。他のPHPコードは許可されていません。これはページの解析時にPHPクラスに変換されるためです。 名前空間参照の使用例: + + url = "/blog" + layout = "default" + == + + == + +一般的な変数の設定方法として、 `$this`で配列アクセスメソッドを使用する必要がありますが、簡略化するために読み込み専用オブジェクトのようにも使用できます。例として: + + // Write via array + $this['foo'] = 'bar'; + + // Read via array + echo $this['foo']; + + // Read-only via object + echo $this->foo; + + +### Twigマークアップセクション + +Twigセクションは、テンプレートによってレンダリングされるマークアップを定義しています。Twigセクションでは、[Octoberが提供する関数、タグ、フィルター](../markup)、すべての[Twig本来の機能](http://twig.sensiolabs.org/documentation)、[プラグインが提供する機能](../plugin/registration#extending-twig)を使用できます。Twigセクションのコンテンツは、テンプレートのタイプ(ページ、レイアウト、パーシャル)によって異なります。 特定のTwigオブジェクトの詳細については、ドキュメントを参照してください。 + +詳細は[マークアップガイド](../markup)をご覧ください。 + + +## テーマロギング + +OctoberCMSにはテーマロギングという非常に便利な機能が備わっていますが、 デフォルトで無効になっています。 + +レイアウトとページではほとんどのデータがフラットファイルに保存されるため、誤ってコンテンツを失う可能性があります。例えばページのレイアウトを切り替えると、ページのスキャホールドが変更されるため、データが失われます。 + +テーマロギングを有効にするには、 **設定 -> Log settings** に移動して **Log theme changes** を有効にします。 これですべての変更が記録されます。 + +テーマ変更ログは **設定 -> Theme log** から見ることができます。各変更には、追加/削除された内容の概要と、その前後に変更されたファイルのコピーがあります。必要に応じて、この情報を適切なアクションの決定や変更のリバージョンのために使用できます。