質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

phpMyAdmin

phpMyAdminはオープンソースで、PHPで書かれたウェブベースのMySQL管理ツールのことです。

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

Q&A

2回答

9547閲覧

nginxサーバーでのphpMyAdmin設定「403 Forbidden 」と表示されてしまう

www.forest

総合スコア10

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

phpMyAdmin

phpMyAdminはオープンソースで、PHPで書かれたウェブベースのMySQL管理ツールのことです。

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

0グッド

0クリップ

投稿2016/04/19 06:33

編集2016/04/19 15:27

いつもお世話になっております。
phpMyAdminについて質問させて下さい。

nginx の場合のphpmyadminの設定
http://ドメイン/phpMyAdmin/でブラウザ表示すると

403 Forbidden

nginx/1.0.15

と表示されてしまいます。
allowのIPアドレスに現在のブラウザIPを入れる必要があるかなと思い設定したのですが、設定が間違っているのか未だ正常に表示されません。
分かる方がいらっしゃいましたら教えて頂きますと幸いです。

■環境
sakura vps 2core
centos6
nginx
php5-fpm
phpMyAdmin
インストール済み
データベース作成済み

nginxのファイル移動等はしておりません。

default.conf

# # The default server # server { listen 80 default_server; server_name ドメイン設定済み; #charset koi8-r; #access_log logs/host.access.log main; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { root /var/www/01/wp; index index.php; if (!-e $request_filename) { rewrite ^/(.+)$ /index.php?q=$1 last; break; } } # phpmyadmin setting location /phpMyAdmin { alias /usr/share/phpMyAdmin/; try_files $uri $uri/ /index.php; location ~ ^/phpMyAdmin/(.+\.php)$ { alias /usr/share/phpMyAdmin; fastcgi_pass unix:/var/run/php-fpm/php5-fpm.socket; fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin/$1; include fastcgi_params; fastcgi_intercept_errors on; allow 許可するIPアドレス; deny all; } } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass unix:/var/run/php-fpm/php5-fpm.socket; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/01/wp/$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }

phpMyAdmin.conf

# phpMyAdmin - Web based MySQL browser written in php # # Allows only localhost by default # # But allowing phpMyAdmin to anyone other than localhost should be considered # dangerous unless properly secured by SSL Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin <Directory /usr/share/phpMyAdmin/> AddDefaultCharset UTF-8 <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require ip 127.0.0.1 Require ip ::1 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory> <Directory /usr/share/phpMyAdmin/setup/> <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require ip 127.0.0.1 Require ip ::1 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory> # These directories do not require access over HTTP - taken from the original # phpMyAdmin upstream tarball # <Directory /usr/share/phpMyAdmin/libraries/> Order Deny,Allow Deny from All Allow from None </Directory> <Directory /usr/share/phpMyAdmin/setup/lib/> Order Deny,Allow Deny from All Allow from None </Directory> <Directory /usr/share/phpMyAdmin/setup/frames/> Order Deny,Allow Deny from All Allow from None </Directory> # This configuration prevents mod_security at phpMyAdmin directories from # filtering SQL etc. This may break your mod_security implementation. # #<IfModule mod_security.c> # <Directory /usr/share/phpMyAdmin/> # SecRuleInheritance Off # </Directory> #</IfModule>

phpMyAdminはデフォルト設定です。
こちらをいじればいのかと思うのですが、
どの様に記述すれば表示されますでしょうか。
ドメイン名/phpmyadmin/で表示させるつもりです。
お分かりになる方いらっしゃいましたら何卒宜しくお願い致します。

【追記 nginxのエラーログ】
2016/04/20 00:21:57 [error] 26801#0: *68 directory index of "/usr/share/phpMyAdmin//" is forbidden, client: IPアドレス, server: ドメイン, request: "GET /phpMyAdmin/ HTTP/1.1", host: "ドメイン"
この様に表示されております。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

t_obara

2016/04/19 10:25

まず、ログを確認すべきでしょう。それを見てもわからない場合、その情報を提示されることをお勧めいたします。
www.forest

2016/04/19 15:27

有難うございます。nginxのエラーログを記載させて頂きました。
guest

回答2

0

解決致しました!回答者の方、大変有難うございましたm(_ _)m
私の環境の場合、下記の記述で表示されました。
おそらく、SCRIPT_FILENAMEの部分が間違っていたのかと思います。

location /phpmyadmin { alias /usr/share/phpMyAdmin/; index index.php; } location ~ ^/phpmyadmin.+\.php$ { fastcgi_pass unix:/var/run/php-fpm/php5-fpm.socket; fastcgi_index index.php; fastcgi_split_path_info ^/phpmyadmin(.+\.php)(.*)$; fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin$fastcgi_script_name; include /etc/nginx/fastcgi_params; }

この度は誠に有難うございました!

投稿2016/04/19 15:52

www.forest

総合スコア10

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

www.forest

2016/04/20 05:33

【追記】 その後、表示される様になりましたが、リダイレクト先がおかしく、また、ログイン後に管理画面に入れない状態になっておりました。 解決しましたので、その手順も合わせて記載しておきます。 ■phpmyadminアクセスでエラーが出る場合 Cookie情報を保存する一時保存フォルダが効いていない可能性 フォルダを作り、実行権限をnginxに与える php infoで情報確認 session.save_pathの場所を確認 /var/lib/php/sessionの場合が多い mkdir /var/lib/php/session chown nginx /var/lib/php/session sessionのパーミッションを755に設定しなおして再起動 ■リダイレクト先がおかしい場合 vim /etc/phpMyAdmin/config.inc.php 下記を追加 ---------- $cfg['PmaAbsoluteUri'] = 'http://ドメイン名/phpmyadmin/';
guest

0

パーミッションの設定が間違っていませんか?

投稿2016/04/19 10:01

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

www.forest

2016/04/19 10:10 編集

回答有難うございます。 パーミッションはデフォルトのまま記載しています。 <Directory /usr/share/phpMyAdmin/> AddDefaultCharset UTF-8 <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require ip 127.0.0.1 Require ip ::1 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory> のローカルIP許可になっている部分を全てIPアドレスにすれば問題なさそうでしょうか。
退会済みユーザー

退会済みユーザー

2016/04/19 10:16

phpMyAdmin のディレクトリ、ファイルのパーミッションに実行権限はついていますか?
www.forest

2016/04/19 11:59

実行権限は755に設定してみましたが、上手くいきませんでした。 パーミッションかルーティング、許可するIPアドレスのどれかが原因かと考えています…
退会済みユーザー

退会済みユーザー

2016/04/19 14:39

上位ディレクトリにも実行権限はついていますか?
www.forest

2016/04/19 15:31

phpMyAdminのパス /usr/share/phpMyAdmin/ usr 755 share 755 phpMyAdmin 755 phpMyAdmin内のindex.php 755 このようになっているという事は、IPアドレス許可に問題があると言えますでしょうか。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問