Apache サーバーから Nginx に移動したい Joomla Web サイトがあります。私のウェブサイトには 3 つの言語があり、すべての URL は/en
、/ua
またはで始まります/ru
。SEF URL が有効になり、Apache で完全に機能します。
Web サイト フォルダーには .htaccess ファイルがあり、(私が理解している限り) 最も重要なディレクティブは次のとおりです。
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
DirectoryIndex index.php index.html
Options +FollowSymLinks
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.*) index.php
RewriteCond %{HTTP:Authorization} !^$
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
http://winginx.com/en/htaccessコンバーターを使用し、その結果を/etc/nginx/site-available/domain.com
ファイルに配置しました。
index index.php index.html;
autoindex off;
location / {
if ($http_host ~* "^www.domain.com$") {
rewrite ^(.*)$ http://domain.com/$1 redirect;
}
if (-e $request_filename) {
rewrite ^/(.*) /index.php;
}
}
次に、マニュアル ( https://docs.joomla.org/Enabling_Search_Engine_Friendly_%28SEF%29_URLs#Nginx ) を読みましたが、役に立ちtry_files $uri $uri/ /index.php?q=$request_uri;
ませexpires 1d; try_files $uri $uri/ /index.php?$args;
ん。
前の段落のディレクティブを使用してブラウザで Web サイトを開こうとすると、504 (ゲートウェイ タイムアウト) エラーが発生します。error.log には次のエラーが含まれています:
*1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 176.***.**.***, server: domain.com, request: "GET /en/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "domain.com"
これを使用せず、.htaccess から変換されたディレクティブのみを使用すると、500 (内部サーバー) エラーが発生し、error.log に次のものが含まれます。
*1 rewrite or internal redirection cycle while internally redirecting to "/ru/", client: 176.***.**.***, server: domain.com, request: "GET /ru/ HTTP/1.1", host: "domain.com"
私は一日中解決策をグーグルで検索しようとしていますが、専門家の助けがなければこれを処理できないと思います:(
また、Joomla コントロール パネルで、「SEF URL は Apache と IIS7 で正しく機能する」ことがわかりましたが、Nginx に関する情報はありません。docs.joomla.org には解決策がありますが、機能しないか、何か間違ったことをしています =/
お願いします。ヘルプ!