我最近用Apache 2.4configuration了Debian 8。 由于我有一个相当新的Apache版本,我使用了ProxyPassMatch而不是FastCgiExternalServer。
但是当为PhpMyAdminconfiguration我的别名时,我想知道这是否安全。 这是我的configuration:
<VirtualHost *:80> ServerName www.my-website.com DocumentRoot /var/www/html/ Alias /phpmyadmin/ "/usr/share/phpmyadmin/" <Directory "/usr/share/phpmyadmin/"> Options FollowSymLinks DirectoryIndex index.php </Directory> # Disallow web access to directories that don't need it <Directory /usr/share/phpmyadmin/libraries> Order Deny,Allow Deny from All Require all granted </Directory> <Directory /usr/share/phpmyadmin/setup/lib> Order Deny,Allow Deny from All Require all granted </Directory> ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/run/php5-fpm-pma.sock|fcgi://localhost/usr/share" ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn </VirtualHost>
有什么困扰我的是ProxyPassMatch,它允许加载以.php *结尾的/usr/share/目录中的任何文件。 我只想执行/usr/share/phpmyadmin/文件,但是因为它是一个别名,所以/phpmyadmin/ part已经被添加了=>
ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/run/php5-fpm-pma.sock|fcgi://localhost/usr/share/phpmyadmin/"
不起作用,错误,找不到“/usr/share/phpmyadmin/phpmyadmin/index.php”。
那么我的实际configuration是否足够安全地访问/usr/share/ ?
感谢您的帮助!
我有同样的问题,首先可以让:
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/php/php7.0-fpm.sock|fcgi://localhost/var/www/html/
在/etc/apache2/sites-available/000-default.conf
但诀窍是简单地创build一个像这样的符号链接:
ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
之后,你必须执行“ systemctl reload apache2 ”,它再次工作。