所以在docker-compose.yml中我有这2个条目:
nginx:
image: nginx
volumes:
- ./app:/var/www/html:delegated
- ./config/nginx/default.conf:/etc/nginx/conf.d/default.conf
ports:
- "444:444"
depends_on:
- laravel
laravel:
image: php:8-fpm
volumes:
- ./app:/var/www/html:delegated
ports:
- "4444:4444"
nginx的配置文件如下所示:
server {
index index.php;
listen 444 ssl;
server_name local.myapp;
root /var/www/html/public;
ssl_certificate /root/ssl/certificate.pem;
ssl_certificate_key /root/ssl/key.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location ~ [^/]\.php(/|$) {
try_files $uri =404;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
root /var/www/html/public;
fastcgi_pass laravel:4444;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 900s;
include fastcgi_params;
}
}
当我转到https://local.myapp:444时,我可以根据app/routes/web.php中指定的路径看到laravel的起始页:
Route::get('/', function () {
return view('welcome');
});
然而,有了这个:
Route::get('/wel', function () {
return view('welcome');
});
当我转到“https://local.myapp:444/wel“时,结果是“404未找到”。
一定是default.conf中的某个地方出错了,但我看不出是什么。
1条答案
按热度按时间dgtucam11#
增加:
成功了。