やりたいこと:
WordPressのページURLをindex.php無しで正規化しつつ
phpMyAdminを使用したい。
現状:
https://www.hoge.com/phpMyAdmin/
でログインしても、ログインIDとパスワード入力画面が出続ける
index.php無しにする正規化の部分(#A)を削除すると
phpMyAdminにはアクセスできるが
WordPressのページURLにindex.phpが表示されてしまう。
環境:
CentOS7 / php7.3 / kusanagi
WordPressはhttps://www.hoge.com/wp/にインストール
phpMyAdminはhttps://www.hoge.com/phpMyAdmin/にインストール
config(抜粋):
ssl.conf
1server { 2 listen 443 ssl http2; 3 server_name hoge.com; 4 ssl_certificate /etc/letsencrypt/live/hoge.com/fullchain.pem; # managed by Certbot 5 ssl_certificate_key /etc/letsencrypt/live/hoge.com/privkey.pem; # managed by Certbot 6 ssl_dhparam /etc/kusanagi.d/ssl/dhparam.key; 7 ssl_session_tickets on; 8 ssl_session_ticket_key /etc/kusanagi.d/ssl_sess_ticket.key; 9 ssl_session_cache shared:SSL:1m; 10 ssl_session_timeout 5m; 11 ssl_protocols TLSv1.2 TLSv1.3; 12 ssl_ciphers "AES128+ECDHE:AES256+ECDHE:AES128+EDH:AES256+EDH:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4!CAMELLIA!AES128-SHA!AES128-SHA256!AES128-GCM-SHA256:!AES256-GCM-SHA384:!AES256-SHA256:!AES256-SHA!AES256-CCM8!AES256-CCM!AES128-CCM!ARIA128-GCM-SHA256!AES128-CCM8!ARIA256-GCM-SHA384"; 13 ssl_prefer_server_ciphers on; 14 access_log /home/kusanagi/aaa/log/nginx/ssl_access.log main; 15 error_log /home/kusanagi/aaa/log/nginx/ssl_error.log warn; 16 17 charset UTF-8; 18 client_max_body_size 50M; 19 root /home/kusanagi/aaa/DocumentRoot; 20 index index.php index.html index.htm; 21 22 location = /50x.html { 23 return 403; 24 } 25 26 rewrite /wp-admin$ $scheme://$host$uri/ permanent; 27 28 location / { 29 try_files $uri $uri/ /index.php?$args; 30 31# B-start index.phpの内容がダウンロードされる 32 location ~ .php(.*)$ { 33 if ($request_uri ~* "^(.*/)index.php(.*)$") { 34 return 301 $1$2; 35 } 36 } 37# B-end 38 } 39 40 location = /favicon.ico { 41 log_not_found off; 42 access_log off; 43 } 44 45 location ~* /.well-known { 46 allow all; 47 } 48 49 location /phpMyAdmin/ { 50 # Outer Word Press Files 51 root /home/kusanagi/aaa/DocumentRoot; 52 index index.php index.html index.htm; 53 } 54 55 location ~* /. { 56 deny all; 57 } 58 59 location ~* /(?:uploads|files)/.*.php$ { 60 deny all; 61 } 62 63 location ~* .(jpg|jpeg|gif|png|css|js|swf|ico|pdf|svg|eot|ttf|woff)$ { 64 expires 60d; 65 access_log off; 66 } 67 68# A-start 69 #if ($request_uri ~* "^(.*/)index.php(.*)$") { 70 # return 301 $1$2; 71 #} 72# A-end 73 74 location ~* /wp-login.php|/wp-admin/((?!(admin-ajax.php|images/)).)*$ { 75 satisfy any; 76 allow 0.0.0.0/0; 77 allow 127.0.0.1; 78 deny all; 79 auth_basic "basic authentication"; 80 auth_basic_user_file "/home/kusanagi/.htpasswd"; 81 location ~ [^/].php(/|$) { 82 fastcgi_split_path_info ^(.+?.php)(/.*)$; 83 if (!-f $document_root$fastcgi_script_name) { 84 return 404; 85 } 86 fastcgi_pass 127.0.0.1:9000; 87 fastcgi_index index.php; 88 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 89 include fastcgi_params; 90 fastcgi_buffers 256 128k; 91 fastcgi_buffer_size 128k; 92 fastcgi_intercept_errors on; 93 fastcgi_read_timeout 120s; 94 } 95 include conf.d/security.conf; 96 } 97 98 location ~ [^/].php(/|$) { 99 fastcgi_split_path_info ^(.+?.php)(/.*)$; 100 if (!-f $document_root$fastcgi_script_name) { 101 return 404; 102 } 103 fastcgi_pass 127.0.0.1:9000; 104 fastcgi_index index.php; 105 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 106 include fastcgi_params; 107 fastcgi_buffers 256 128k; 108 fastcgi_buffer_size 128k; 109 fastcgi_intercept_errors on; 110 fastcgi_read_timeout 120s; 111 112 set $do_not_cache 1; ## page cache 113 set $device "pc"; 114 115 if ($request_method = POST) { 116 set $do_not_cache 1; 117 } 118 119 if ($query_string != "") { 120 set $do_not_cache 1; 121 } 122 123 if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { 124 set $do_not_cache 1; 125 } 126 127 if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { 128 set $do_not_cache 1; 129 } 130 131 if ($http_user_agent ~* " Android |(iPad|Android; Tablet; .+Firefox") { 132 set $device "tablet"; 133 } 134 135 if ($http_user_agent ~* "Android .+ Mobile|(iPhone|(iPod|IEMobile|Android; Mobile; .+Firefox|Windows Phone") { 136 set $device "smart"; 137 } 138 139 fastcgi_cache wpcache; 140 fastcgi_cache_key "$device:$request_method:$scheme://$host$request_uri"; 141 fastcgi_cache_valid 200 10m; 142 fastcgi_no_cache $do_not_cache; 143 fastcgi_cache_bypass $do_not_cache; 144 145 add_header X-F-Cache $upstream_cache_status; 146 add_header X-Signature KUSANAGI; 147 include conf.d/security.conf; 148 } 149 150 location ~ /fcache-purge/([^/]+)(/.*) { 151 allow 127.0.0.1; 152 deny all; 153 fastcgi_cache_purge wpcache "$1:GET:$scheme://$host$2"; 154 } 155 156 # WebP Express rules 157 # -------------------- 158 location ~* /wp/wp-content/.*.(png|jpe?g)$ { 159 add_header Vary Accept; 160 expires 365d; 161 if ($http_accept !~* "webp"){ 162 break; 163 } 164 try_files 165 /wp/wp-content/webp-express/webp-images/doc-root/$uri.webp 166 $uri.webp 167 /wp/wp-content/plugins/webp-express/wod/webp-on-demand.php?xsource=x$request_filename&wp-content=wp-content 168 ; 169 } 170 171 # Route requests for non-existing webps to the converter 172 location ~* /wp/wp-content/.*.(png|jpe?g).webp$ { 173 try_files 174 $uri 175 /wp/wp-content/plugins/webp-express/wod/webp-realizer.php?wp-content=wp-content 176 ; 177 } 178 # ------------------- (WebP Express rules ends here) 179 180 # WebP extra folder rules 181 # ------------------------- 182 location ~* /images/.*.(png|jpe?g)$ { 183 add_header Vary Accept; 184 try_files $uri$webp_suffix $uri =404; 185 } 186 location ~* /AAA/.*.(png|jpe?g)$ { 187 add_header Vary Accept; 188 try_files $uri$webp_suffix $uri =404; 189 } 190 location ~* /common/images/.*.(png|jpe?g)$ { 191 add_header Vary Accept; 192 try_files $uri$webp_suffix $uri =404; 193 } 194}
回答1件
あなたの回答
tips
プレビュー