我正在尝试停靠symfony2应用程序。容器已启动并运行,没有任何错误。但是,当我在浏览器中点击http://localhost:8081时,出现“连接到localhost时发生错误”
docker-compose.yml
version: "3.8"
services:
app:
container_name: "${PROJECT_NAME}"
build:
context: .
dockerfile: ./Dockerfile
restart: 'always'
ports:
- 8081:80
volumes:
- .:/var/www/html
- ${LOG_DIR-./logs/apache2}:/var/log/apache2
停靠文件
FROM php:7.0-apache
RUN a2enmod rewrite
COPY ./000-default.conf /etc/apache2/sites-available/000-default.conf
// installing php extensions / libraries and composer ..
EXPOSE 80
CMD ["apache2-foreground"]
000-default.conf
Listen 80
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/html/web
<Directory /var/www/html/web>
EnableSendfile Off
AllowOverride None
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app_dev.php [QSA,L]
</IfModule>
</Directory>
</VirtualHost>
1条答案
按热度按时间e3bfsja21#
我生成了ssl证书(参考https://medium.com/@nh3500/how-to-create-self-assigned-ssl-for-local-docker-based-lamp-dev-environment-on-macos-sierra-ab606a27ba8a)并更新了文件,如下所示
000-default.conf
docker-compose.yml
停靠文件