Hello, I have a problem and I don’t know how to solve it and who to ask.
I’ve been trying to make a development environment but every time I fail. Every time it redirects to https. On https it tells me that the site is unavailable. First with nginx and now with apache. I don’t know where I’m wrong. Maybe my approach is not the best.
I want to configure apache2 to have 3 custom domains, + 1 for mailserver and one for phpmyadmin.
I know it’s not suitable for a development environment but the application I’m trying to make is quite complicated and difficult.
local.dev.conf for tests
wordpress.dev.conf for website
xxx.dev.conf for api
bookmark.dev.conf for core project
phpmyadmin.dev
mailserver.local
This is my structure
/dev-environment
├── docker-compose.yml
├── apache
│ ├── site_config_local.dev.conf
│ ├── site_config_wordpress.dev.conf
│ ├── site_config_xxx.dev.conf
│ ├── site_config_bookmark.dev.conf
├── php
│ ├── Dockerfile
│ ├── php.ini
├── ssl
│ │── local.dev.crt
│ │── local.dev.key
│ │── wordpress.dev.crt
│ │── wordpress.dev.key
│ │── xxx.dev.crt
│ │── xxx.dev.key
│ │── bookmark.dev.crt
│ │── bookmark.dev.key
├── sites
│ ├── localdev
│ ├── wordpress
│ ├── xxx
│ └── bookmark
I m sorry but i can’t upload files.
docker-compose.yml
services:
apache:
image: php:8.3-apache
container_name: apache
volumes:
- ./sites:/var/www/html
- ./apache:/etc/apache2/sites-available
- ./ssl:/etc/ssl/certs
ports:
- "80:80"
- "443:443"
- "9003:9003"
networks:
- app_network
environment:
- VIRTUAL_HOST=local.dev,wordpress.dev,xxx.dev,bookmark.dev
restart: always
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
environment:
- VIRTUAL_HOST=phpmyadmin.dev
- PMA_HOST=apache
- PMA_PORT=3306
networks:
- app_network
ports:
- "8080:80"
restart: always
mailhog:
image: mailhog/mailhog
container_name: mailhog
ports:
- "1025:1025"
- "8025:8025"
networks:
- app_network
environment:
- VIRTUAL_HOST=mailserver.local
restart: always
networks:
app_network:
driver: bridge
Dockerfile
[PHP]
max_execution_time = 300
memory_limit = 512M
post_max_size = 50M
upload_max_filesize = 50M
[Date]
date.timezone = "Europe/Bucharest"
[xdebug]
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal
xdebug.client_port=9003
xdebug.log=/var/log/xdebug.log
site_config_local.dev.conf
<VirtualHost *:80>
ServerAdmin webmaster@local.dev
ServerName local.dev
DocumentRoot /var/www/html/localdev
# Redirecționează HTTP către HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/localdev>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@local.dev
ServerName local.dev
DocumentRoot /var/www/html/localdev
SSLEngine on
SSLCertificateFile /etc/ssl/certs/local.dev.crt
SSLCertificateKeyFile /etc/ssl/certs/local.dev.key
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/localdev>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I’m about to give up on this approach, but I’d like to know before I give up that I’ve done everything I can.