2
以下の設定ファイルはsites-enabled
にあります。私はmod_proxy_fcgi
を使用しています。ApacheがPHPファイルをPHP-FPMに渡すのではなく、なぜ出力しますか?
ServerName local.dev
<Directory /var/www/local/>
AllowOverride all
Require all granted
</Directory>
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerAlias *.local.*.com
SetEnv CURRENT_ENVIRONMENT ENV_DOCKER
ServerAdmin [email protected]
VirtualDocumentRoot /var/www/local/%3/trunk/%3+-%1/site/www
ProxyPassMatch "^/var/www/local/(.*/trunk/.*/site/www/.*\.php.*)$" "fcgi://php:9000/var/www/local/$1"
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
LogLevel debug
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerAlias local.*.com
SetEnv CURRENT_ENVIRONMENT ENV_DOCKER
ServerAdmin [email protected]
VirtualDocumentRoot /var/www/local/%2/trunk/%2+/site/www
ProxyPassMatch "^/var/www/local/(.*/trunk/.*/site/www/.*\.php.*)$" "fcgi://php:9000/var/www/local/$1"
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
LogLevel debug
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
は、うーん... ProxyPassMatchに、私は非引用符で囲まれた文字列を(ではない、それは一定の事項)、代わりにfcgiの 'の使用:// PHPは://127.0:9000/blabla'は、私がfcgiの'設定さ.0.1:9000/blabla' ...あなたのphp-fpmがもちろんlocalhostで動いていると仮定します。 – YvesLeBorg
私のphp-fpmはlocalhost上で実行されていません。これは 'php'という名前のドッカーコンテナの中で実行されています。私も引用符なしで試しましたが、サイコロはありませんでした。 mod_proxy_fcgiのマニュアルの公式の例には引用符があります。 – sluther
ここではApacheを実行しているボックスから 'php'を解決できます(DNS単位)。また、確かに 'AddType application/x-httpd-php .php'をApacheのMIME設定のどこかに置いてください。 – YvesLeBorg