Кажется, я не могу заставить phpmyadmin правильно работать с моей текущей настройкой Apache / 2.4.7 (Ubuntu: Trusty).
Phpmyadmin установлен правильно, и я добавил /etc/phpmyadmin/apache.conf
файл в VirtualHost
сам, но переход к https://www.domain.com/phpmyadminpanel/
, дает мне ответ 404, в то время как остальная часть сайта работает правильно.
Я не совсем уверен, что могло быть причиной этого, я упустил что-то очевидное?
/etc/phpmyadmin/apache.conf
# phpMyAdmin default Apache configuration
Alias /phpmyadminpanel /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_admin_flag allow_url_fopen Off
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/
</IfModule>
</Directory>
# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
<IfModule mod_authn_file.c>
AuthType Basic
AuthName "phpMyAdmin Setup"
AuthUserFile /etc/phpmyadmin/htpasswd.setup
</IfModule>
Require valid-user
</Directory>
# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/libraries>
Order Deny,Allow
Deny from All
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
Order Deny,Allow
Deny from All
</Directory>
/etc/apache2/sites-enabled/domain.com.conf
# Redirect HTTP traffic to HTTPS
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
Redirect / https://www.domain.com/za
</VirtualHost>
# Redirect HTTP traffic to HTTPS
<VirtualHost *:80>
ServerName sub.domain.com
Redirect / https://sub.domain.com/na
</VirtualHost>
# HTTPS configuration
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerName domain.com
ServerAlias www.domain.com
ServerAlias sub.domain.com
ServerAdmin info@domain.com
DocumentRoot /var/www/html
DirectoryIndex index.php
# Logging and such
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# Enable mod_ssl and mod_rewrite
RewriteEngine on
SSLEngine on
RewriteCond %{HTTP_HOST} ^sub.domain.com$
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule ^/?(.*)$ /na/ [R=301]
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule ^/?(.*)$ https://www.domain.com/za/ [R=301]
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} ^/na/.*$
RewriteRule ^/na/(.*)$ https://www.domain.com/za/$1 [R=301]
RewriteCond %{HTTP_HOST} ^sub.domain.com$
RewriteCond %{REQUEST_URI} ^/za/.*$
RewriteRule ^/za/(.*)$ /na/$1 [R=301]
RewriteCond %{REQUEST_URI} ^.*\.php$
RewriteRule ^/(.*)\.php$ /$1 [R=301,QSA]
RewriteCond %{REQUEST_URI} !^/za/admn/.*
RewriteCond %{REQUEST_URI} !^/za/ea/.*
RewriteCond %{REQUEST_URI} ^/.*/index$
RewriteRule ^/(.*)/index$ /$1 [R=301,QSA]
RewriteCond %{HTTP_HOST} ^sub.domain.com$
RewriteCond %{REQUEST_URI} ^/na/.*$
RewriteRule ^/na/(.*)$ /za/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f
RewriteRule ^/(.*)$ /$1.php [L,QSA]
# SSL Stuff goes here
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
Include /etc/phpmyadmin/apache.conf
</VirtualHost>
</IfModule>
У вас есть конфигурация include для PHPMyAdmin после другой конфигурации, которая включает перенаправление для всех:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f
RewriteRule ^/(.*)$ /$1.php [L,QSA]
Итак, переместите свой Include
заявление ранее в файле конфигурации.