タイトルのことをしたく、ALBを下記リンクを参考にターゲットグループを作成し
from internet
[internet] http -> 80 [ALB] http -> 81 [nginx] (https redirect)
[internet] https -> 433 [ALB] http -> 80 [nginx] http -> any [WordPress]from health-checker
[health-checker] http -> 80 [nginx] http -> any [WordPress]
のようにしたいのですが、ヘルスチェックでunhealthyになります。
http://qiita.com/spaceprobe/items/96550d3214f2930f8b1a
nginxの設定は以下になります。
fastcgi_pass unix:/var/run/php-fpm.sock; ```の箇所は、実際にそこに存在しているために変更しています。 何かご意見頂けますでしょうか?宜しくお願いします。 default.conf ---
server {
listen 81;
server_name example.com;
rewrite ^ https://$host$request_uri permanent;
}
server {
listen 80 http2;
listen [::]:80 http2;
server_name www.example.com;
return 301 http://example.com$request_uri;
}
server {
client_max_body_size 96M;
listen 80 http2;
listen [::]:80 http2;
root /var/www/html/wordpress;
server_name example.com;
charset utf-8;
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains'; #resolver 8.8.4.4 8.8.8.8 valid=300s; resolver 127.0.0.1; resolver_timeout 10s; #return 301 https://$host$request_uri; # maintenance setting set $maintenance false; if (-e /var/tmp/maintenance.mode) { set $maintenance true; } if ($http_x_forwarded_for ~ ^(xxx.xxx.xxx.xxx|xxx.xxx.xxx.xxx)) { set $maintenance false; } #if ($maintenance = true) { # return 503; #} #error_page 503 @maintenance; #location @maintenance { # rewrite ^(.*)$ https://xxx.cloudfront.net break; #} location / { root /var/www/html/wordpress; index index.html index.htm index.php; try_files $uri $uri/ /index.php?q=$uri&$args @wp; if (!-e $request_filename) { rewrite ^.+?(/wp-.*) $1 last; rewrite ^.+?(/.*\.php)$ $1 last; rewrite ^ /index.php last; } } location ~* \.php$ { root /var/www/html/wordpress; try_files $uri @wp; fastcgi_pass unix:/var/run/php-fpm.sock; # fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*); fastcgi_param SCRIPT_FILENAME /var/www/html/wordpress/$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass_header "X-Accel-Redirect"; fastcgi_pass_header "X-Accel-Expires"; fastcgi_read_timeout 180; include fastcgi_params; } location @wp { root /var/www/html/wordpress; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass unix:/var/run/php-fpm.sock; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME /var/www/html/wordpress/index.php; include fastcgi_params; } # wp-config.phpへのアクセスを全て拒否 location ~* /wp-config.php { deny all; } location ~* /(phpmyadmin|myadmin|pma) { access_log off; log_not_found off; return 404; } location = /healthcheck.txt { #access_log off; return 204; break; } # error_page 404 /index.php?error=404; error_page 500 502 503 504 /50x.html; location /favicon { empty_gif; access_log off; log_not_found off; } location = /robots.txt { log_not_found off; access_log off; } location ~ /\. { deny all; log_not_found off; access_log off; } location ~* \.(pdf)$ { add_header X-Robots-Tag noindex; }
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.example.com;
return 301 https://example.com$request_uri;
}
server {
client_max_body_size 96M;
listen 443 ssl default_server http2;
listen [::]:443 ssl http2;
server_name example.com;
root /var/www/html/wordpress;
charset utf-8;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem; ssl_dhparam /etc/nginx/ssl/dhparam.pem; keepalive_timeout 120; ssl_stapling on; ssl_stapling_verify on; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_session_timeout 10m; ssl_session_tickets off; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS'; ssl_prefer_server_ciphers on; add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains'; #resolver 8.8.4.4 8.8.8.8 valid=300s; resolver 10.0.0.2; resolver_timeout 10s; # maintenance setting set $maintenance false; if (-e /var/tmp/maintenance.mode) { set $maintenance true; } if ($http_x_forwarded_for ~ ^(xxx.xxx.xxx.xxx|xxx.xxx.xxx.xxx)) { set $maintenance false; } #if ($maintenance = true) { # return 503; #} #error_page 503 @maintenance; #location @maintenance { # rewrite ^(.*)$ https://xxx.cloudfront.net break; #} location / { root /var/www/html/wordpress; index index.html index.htm index.php; try_files $uri $uri/ /index.php?q=$uri&$args @wp; if (!-e $request_filename) { rewrite ^.+?(/wp-.*) $1 last; rewrite ^.+?(/.*\.php)$ $1 last; rewrite ^ /index.php last; } } location ~* \.php$ { root /var/www/html/wordpress; try_files $uri @wp; fastcgi_pass unix:/var/run/php-fpm.sock; # fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*); fastcgi_param SCRIPT_FILENAME /var/www/html/wordpress/$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass_header "X-Accel-Redirect"; fastcgi_pass_header "X-Accel-Expires"; fastcgi_read_timeout 180; include fastcgi_params; } location @wp { root /var/www/html/wordpress; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_param SCRIPT_FILENAME /var/www/html/wordpress/index.php; include fastcgi_params; } # wp-config.phpへのアクセスを全て拒否 location ~* /wp-config.php { deny all; } location ~* /(phpmyadmin|myadmin|pma) { access_log off; log_not_found off; return 404; } location = /healthcheck.txt { #access_log off; return 204; break; } location ^~ /.well-known/acme-challenge { root /usr/local/letsencrypt; access_log /var/log/nginx/access_letsencrypt.log; error_log /var/log/nginx/error_letsencrypt.log; } # direcct access location = /.well-known/acme-challenge { return 404; } # error_page 404 /index.php?error=404; error_page 500 502 503 504 /50x.html; location /favicon { empty_gif; access_log off; log_not_found off; } location = /robots.txt { log_not_found off; access_log off; } location ~ /\. { deny all; log_not_found off; access_log off; } location ~* \.(pdf)$ { add_header X-Robots-Tag noindex; }
}
回答1件
あなたの回答
tips
プレビュー