表題の通り/ありのURL(トレイリング スラッシュ)をnginxでリダイレクトさせるようにしたいと考えています。
○リダイレクトしたいURL例○
リダイレクトしたいURL:https://ドメイン名/blog/6/
リダイレクト先URL :https://ドメイン名/blog/6
※https://ドメイン名/blog/までは固定ですが、数字の部分は記事のidの為、動的に変化します。
リダイレクトの設定は理解しているのですが、同的に変化する値をnginxに設定できるかの
調査方法が分からない為、どなたか対応方法をご教授いただければと存じます。
開発環境
AWS EC2(Linux)
Nginx
現在のnginxの設定方法
# log directory error_log /var/www/test/log/nginx.error.log; access_log /var/www/test/log/nginx.access.log; # max body size client_max_body_size 2G; upstream app_server { # for UNIX domain socket setups server unix:/var/www/test/tmp/sockets/.unicorn.sock fail_timeout=0; } server { listen 80; server_name 自サイトのIP; # nginx so increasing this is generally safe... keepalive_timeout 5; # path for static files root /var/www/test/public; # page cache loading try_files $uri/index.html $uri.html $uri @app; location @app { # HTTP headers proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://app_server; } # Rails error pages error_page 500 502 503 504 /500.html; location = /500.html { root /var/www/test/public; } }

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/03/27 03:54