Skip to content

Commit a0fbd1b

Browse files
committed
Nginx の laravel 設定を laravel11.x の最新のものに変更
1 parent 4d2ab13 commit a0fbd1b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docker/web/nginx/default.d/02.laravel.conf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# https://laravel.com/docs/10.x/deployment
1+
# https://laravel.com/docs/11.x/deployment#nginx
22
#
33

44
add_header X-Frame-Options "SAMEORIGIN";
@@ -17,14 +17,18 @@ location = /robots.txt { access_log off; log_not_found off; }
1717

1818
error_page 404 /index.php;
1919

20-
location ~ \.php$ {
20+
location ~ ^/index\.php(/|$) {
2121
# NOTE: ../default.d/03.php.conf に設定を移譲しているため。
2222
# fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
2323
fastcgi_pass php-fpm;
2424

2525
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
2626
include fastcgi_params;
2727

28+
# NOTE: PHPがデフォルトで返すバージョン情報のヘッダーを非表示にする
29+
# 基本的には php.ini の expose_php = Off で無効化されているが、念のため Nginx でも非表示にしておく
30+
fastcgi_hide_header X-Powered-By;
31+
2832
# NOTE: デフォルトから追加した設定
2933
# php-fpm動作時のバッファ量
3034
fastcgi_buffer_size 16k;

0 commit comments

Comments
 (0)