Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ msgstr ""
#: ../src/cookbook/configuring-webservers/apache.md
#, no-wrap
msgid "Configuring web servers: Apache"
msgstr ""
msgstr "配置 Web 服务器:Apache"

#. type: Plain text
#: ../src/cookbook/configuring-webservers/apache.md
msgid "Use the following configuration in Apache's `httpd.conf` file or within a virtual host configuration. Note that you should replace `path/to/app/public` with the actual path for `app/public`."
msgstr ""
msgstr "在 Apache 的 `httpd.conf` 文件或虚拟主机配置中使用以下配置。注意,你应该将 `path/to/app/public` 替换为 `app/public` 的实际路径。"

#. type: Fenced code block (apache)
#: ../src/cookbook/configuring-webservers/apache.md
Expand Down Expand Up @@ -52,11 +52,32 @@ msgid ""
" # ...other settings...\n"
"</Directory>\n"
msgstr ""
"# 将文档根目录设置为 \"app/public\"\n"
"DocumentRoot \"path/to/app/public\"\n"
"\n"
"<Directory \"path/to/app/public\">\n"
" # 使用 mod_rewrite 支持美化 URL\n"
" RewriteEngine on\n"
" \n"
" # 如果 UrlManager 中的 $showScriptName 为 false,则不允许访问带脚本名称的 URL\n"
" RewriteRule ^index.php/ - [L,R=404]\n"
" \n"
" # 如果目录或文件存在,直接使用请求\n"
" RewriteCond %{REQUEST_FILENAME} !-f\n"
" RewriteCond %{REQUEST_FILENAME} !-d\n"
" \n"
" # 否则将请求转发到 index.php\n"
" RewriteRule . index.php\n"
" \n"
" SetEnv APP_ENV dev\n"
"\n"
" # ...其他设置...\n"
"</Directory>\n"

#. type: Plain text
#: ../src/cookbook/configuring-webservers/apache.md
msgid "In case you have `AllowOverride All` you can add `.htaccess` file with the following configuration instead of using `httpd.conf`:"
msgstr ""
msgstr "如果你设置了 `AllowOverride All`,可以添加包含以下配置的 `.htaccess` 文件,而不是使用 `httpd.conf`:"

#. type: Fenced code block (apache)
#: ../src/cookbook/configuring-webservers/apache.md
Expand All @@ -79,8 +100,24 @@ msgid ""
"\n"
"# ...other settings...\n"
msgstr ""
"# 使用 mod_rewrite 支持美化 URL\n"
"RewriteEngine on\n"
"\n"
"# 如果 UrlManager 中的 $showScriptName 为 false,则不允许访问带脚本名称的 URL\n"
"RewriteRule ^index.php/ - [L,R=404]\n"
"\n"
"# 如果目录或文件存在,直接使用请求\n"
"RewriteCond %{REQUEST_FILENAME} !-f\n"
"RewriteCond %{REQUEST_FILENAME} !-d\n"
"\n"
"# 否则将请求转发到 index.php\n"
"RewriteRule . index.php\n"
"\n"
"SetEnv APP_ENV dev\n"
"\n"
"# ...其他设置...\n"

#. type: Plain text
#: ../src/cookbook/configuring-webservers/apache.md
msgid "In the above, note the usage of `SetEnv`. Since the Yii3 application template is using environment variables, this is a possible place to set them. In production environment remember to set `APP_ENV` to `prod`."
msgstr ""
msgstr "在上面的配置中,请注意 `SetEnv` 的用法。由于 Yii3 应用程序模板使用环境变量,这是设置它们的一个可行位置。在生产环境中,请记得将 `APP_ENV` 设置为 `prod`。"
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ msgstr ""
#: ../src/cookbook/configuring-webservers/general.md
#, no-wrap
msgid "Configuring web servers: General"
msgstr ""
msgstr "配置 Web 服务器:通用"

#. type: Plain text
#: ../src/cookbook/configuring-webservers/general.md
msgid "On a production server, if you don't use Docker, configure your web server to serve only the application's public files. Point the document root of your web server to the `app/public` folder."
msgstr ""
msgstr "在生产服务器上,如果你不使用 Docker,请配置你的 Web 服务器仅提供应用程序的公共文件。将 Web 服务器的文档根目录指向 `app/public` 文件夹。"

#. type: Plain text
#: ../src/cookbook/configuring-webservers/general.md
Expand All @@ -34,12 +34,15 @@ msgid ""
"> If you're running your Yii application behind a reverse proxy, you might need to configure\n"
"> [Trusted proxies and headers](../../guide/security/trusted-request.md).\n"
msgstr ""
"> [!IMPORTANT]\n"
"> 如果你在反向代理后面运行 Yii 应用程序,可能需要配置\n"
"> [受信任的代理和标头](../../guide/security/trusted-request.md)。\n"

#. type: Title ##
#: ../src/cookbook/configuring-webservers/general.md
#, no-wrap
msgid "Specific server configurations"
msgstr ""
msgstr "特定服务器配置"

#. type: Bullet: '- '
#: ../src/cookbook/configuring-webservers/general.md
Expand Down
10 changes: 5 additions & 5 deletions _translations/po/zh-CN/cookbook_configuring-webservers_iis.md.po
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ msgstr ""
#: en/configuring-webservers/iis.md
#, no-wrap
msgid "Configuring web servers: IIS"
msgstr ""
msgstr "配置 Web 服务器:IIS"

#. type: Plain text
#: en/configuring-webservers/iis.md
msgid "When you use [IIS](https://www.iis.net/), host the application in a virtual host (Website) where the document root points to the `path/to/app/public` folder and configure the website to run PHP. In that `public` folder, place a file named `web.config` at `path/to/app/public/web.config`. Use the following content:"
msgstr ""
msgstr "当你使用 [IIS](https://www.iis.net/) 时,在虚拟主机(网站)中托管应用程序,其中文档根目录指向 `path/to/app/public` 文件夹,并配置网站运行 PHP。在该 `public` 文件夹中,放置一个名为 `web.config` 的文件,路径为 `path/to/app/public/web.config`。使用以下内容:"

#. type: Fenced code block (xml)
#: en/configuring-webservers/iis.md
Expand Down Expand Up @@ -55,14 +55,14 @@ msgstr ""
#. type: Plain text
#: en/configuring-webservers/iis.md
msgid "Also, the following list of Microsoft's official resources could be useful to configure PHP on IIS:"
msgstr ""
msgstr "此外,以下 Microsoft 官方资源列表可能对在 IIS 上配置 PHP 有所帮助:"

#. type: Bullet: '1. '
#: en/configuring-webservers/iis.md
msgid "[How to set up your first IIS website](https://support.microsoft.com/en-us/help/323972/how-to-set-up-your-first-iis-web-site)"
msgstr ""
msgstr "[如何设置你的第一个 IIS 网站](https://support.microsoft.com/en-us/help/323972/how-to-set-up-your-first-iis-web-site)"

#. type: Bullet: '2. '
#: en/configuring-webservers/iis.md
msgid "[Configure a PHP Website on IIS](https://docs.microsoft.com/en-us/iis/application-frameworks/scenario-build-a-php-website-on-iis/configure-a-php-website-on-iis)"
msgstr ""
msgstr "[在 IIS 上配置 PHP 网站](https://docs.microsoft.com/en-us/iis/application-frameworks/scenario-build-a-php-website-on-iis/configure-a-php-website-on-iis)"
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ msgstr ""
#: en/configuring-webservers/lighttpd.md
#, no-wrap
msgid "Configuring web servers: lighttpd"
msgstr ""
msgstr "配置 Web 服务器:lighttpd"

#. type: Plain text
#: en/configuring-webservers/lighttpd.md
#, no-wrap
msgid "To use [lighttpd](https://www.lighttpd.net/) >= 1.4.24, put `index.php` in the web root and add the following to the configuration:\n"
msgstr ""
msgstr "要使用 [lighttpd](https://www.lighttpd.net/) >= 1.4.24,将 `index.php` 放在 Web 根目录中,并将以下内容添加到配置中:\n"

#. type: Fenced code block
#: en/configuring-webservers/lighttpd.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ msgstr ""
#: en/configuring-webservers/nginx-unit.md
#, no-wrap
msgid "Configuring web servers: NGINX Unit"
msgstr ""
msgstr "配置 Web 服务器:NGINX Unit"

#. type: Plain text
#: en/configuring-webservers/nginx-unit.md
msgid "Run Yii-based apps using [NGINX Unit](https://unit.nginx.org/) with a PHP language module. Here is a sample configuration."
msgstr ""
msgstr "使用带有 PHP 语言模块的 [NGINX Unit](https://unit.nginx.org/) 运行基于 Yii 的应用程序。以下是一个示例配置。"

#. type: Fenced code block (json)
#: en/configuring-webservers/nginx-unit.md
Expand Down Expand Up @@ -88,9 +88,9 @@ msgstr ""
#. type: Plain text
#: en/configuring-webservers/nginx-unit.md
msgid "You can also [set up](https://unit.nginx.org/configuration/#php) your PHP environment or supply a custom `php.ini` in the same configuration."
msgstr ""
msgstr "你还可以在同一配置中 [设置](https://unit.nginx.org/configuration/#php) PHP 环境或提供自定义的 `php.ini`。"

#. type: Plain text
#: en/configuring-webservers/nginx-unit.md
msgid "In the above, note the usage of `environment`. Since the Yii3 application template is using environment variables, this is a possible place to set them. In production environment remember to set `APP_ENV` to `prod`."
msgstr ""
msgstr "在上面的配置中,请注意 `environment` 的用法。由于 Yii3 应用程序模板使用环境变量,这是设置它们的一个可行位置。在生产环境中,请记得将 `APP_ENV` 设置为 `prod`。"
53 changes: 48 additions & 5 deletions _translations/po/zh-CN/cookbook_configuring-webservers_nginx.md.po
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ msgstr ""
#: ../src/cookbook/configuring-webservers/nginx.md
#, no-wrap
msgid "Configuring web servers: Nginx"
msgstr ""
msgstr "配置 Web 服务器:Nginx"

#. type: Plain text
#: ../src/cookbook/configuring-webservers/nginx.md
msgid "To use [Nginx](https://wiki.nginx.org/), install PHP as an [FPM SAPI](https://secure.php.net/install.fpm). Use the following Nginx configuration, replacing `path/to/app/public` with the actual path for `app/public` and `mysite.test` with the actual hostname to serve."
msgstr ""
msgstr "要使用 [Nginx](https://wiki.nginx.org/),请将 PHP 安装为 [FPM SAPI](https://secure.php.net/install.fpm)。使用以下 Nginx 配置,将 `path/to/app/public` 替换为 `app/public` 的实际路径,将 `mysite.test` 替换为要提供服务的实际主机名。"

#. type: Fenced code block (nginx)
#: ../src/cookbook/configuring-webservers/nginx.md
Expand Down Expand Up @@ -74,18 +74,61 @@ msgid ""
" }\n"
"}\n"
msgstr ""
"server {\n"
" charset utf-8;\n"
" client_max_body_size 128M;\n"
"\n"
" listen 80; ## 监听 ipv4\n"
" #listen [::]:80 default_server ipv6only=on; ## 监听 ipv6\n"
"\n"
" server_name mysite.test;\n"
" root /path/to/app/public;\n"
" index index.php;\n"
"\n"
" access_log /path/to/basic/log/access.log;\n"
" error_log /path/to/basic/log/error.log;\n"
"\n"
" location / {\n"
" # 将所有不是真实文件的请求重定向到 index.php\n"
" try_files $uri $uri/ /index.php$is_args$args;\n"
" }\n"
"\n"
" # 取消注释以避免 Yii 处理对不存在的静态文件的调用\n"
" #location ~ \\.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {\n"
" # try_files $uri =404;\n"
" #}\n"
" #error_page 404 /404.html;\n"
"\n"
" # 拒绝访问 /assets 目录中的 php 文件\n"
" location ~ ^/assets/.*\\.php$ {\n"
" deny all;\n"
" }\n"
"\n"
" location ~ \\.php$ {\n"
" include fastcgi_params;\n"
" fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n"
" fastcgi_pass 127.0.0.1:9000;\n"
" #fastcgi_pass unix:/var/run/php8-fpm.sock;\n"
" try_files $uri =404;\n"
" fastcgi_param APP_ENV \"dev\";\n"
" }\n"
"\n"
" location ~* /\\. {\n"
" deny all;\n"
" }\n"
"}\n"

#. type: Plain text
#: ../src/cookbook/configuring-webservers/nginx.md
msgid "When you use this configuration, also set `cgi.fix_pathinfo=0` in the `php.ini` file to avoid many unnecessary system `stat()` calls."
msgstr ""
msgstr "使用此配置时,还要在 `php.ini` 文件中设置 `cgi.fix_pathinfo=0`,以避免许多不必要的系统 `stat()` 调用。"

#. type: Plain text
#: ../src/cookbook/configuring-webservers/nginx.md
msgid "Also, note that when running an HTTPS server, you need to add `fastcgi_param HTTPS on;` so that Yii can detect if a connection is secure."
msgstr ""
msgstr "另外,请注意,当运行 HTTPS 服务器时,需要添加 `fastcgi_param HTTPS on;`,以便 Yii 可以检测连接是否安全。"

#. type: Plain text
#: ../src/cookbook/configuring-webservers/nginx.md
msgid "In the above, note the usage of `fastcgi_param APP_ENV`. Since the Yii3 application template is using environment variables, this is a possible place to set them. In production environment remember to set `APP_ENV` to `prod`."
msgstr ""
msgstr "在上面的配置中,请注意 `fastcgi_param APP_ENV` 的用法。由于 Yii3 应用程序模板使用环境变量,这是设置它们的一个可行位置。在生产环境中,请记得将 `APP_ENV` 设置为 `prod`。"
Loading