Nginx で Laravel と phpMyAdmin を使う時の設定ファイルです。
Ubuntu 20.10 で確認しました。
/etc/nginx/sites-available/defalt
server {
listen 80 default_server;
listen [::]:80 default_server;
#
root /var/www/html;
server_name _;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
location ^~ /phpmyadmin {
root /usr/share;
index index.html index.htm index.php;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
}
設定ファイルが正しいか確認
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Nginx の再起動
sudo systemctl restart nginx