提问人:Jonathan Banks 提问时间:10/31/2023 更新时间:10/31/2023 访问量:18
在 Docker 中公开 Apache 会导致主机上 Laravel 应用程序主页的“索引视图”,为什么会这样?
Exposing Apache inside Docker results in the "Index view" of the homepage for a Laravel app on the host, how come?
问:
就上下文而言,我没有使用 Sail 或任何工具。我刚刚得到了一个可以使用的存储库,这更像是一个 Docker 和/或 Apache,但我想我会提到它。
我正在使用 Docker 运行 Ubuntu。我的目标是在容器内安装一个 Laravel 应用程序,并从外部访问它。这是我的(所以,我们在“Debian 做事方式”)文件:apache2.conf
DefaultRuntimeDir ${APACHE_RUN_DIR}
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
这是我的文件,它在目录中:000-default.conf
sites-enabled
<VirtualHost *:80>
ServerAdmin root@localhost
DocumentRoot /var/www/appy
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
我的项目驻留在容器内。没有 .htaccess 文件左右。在我这样做之后,在端口上创建了一个服务器,如果我执行 ,我可以看到它在容器内工作时可以工作。但是,一旦我在它上面构建了另一个图像,以便我可以映射(使用命令),访问只会将我带到文件的索引视图。所以,主人看到了容器 - 耶!但是在翻译中会丢失一些东西。/var/www/appy
php artisan serve
8000
curl
8000:80
docker run -dit -p 8000:80 --name appy_web appy:latest
localhost:8000
这是怎么回事?
答: 暂无答案
评论