Commit 664210e8 authored by Administrator's avatar Administrator

Update 7 files via Son of Anton

parent 63bd524e
Pipeline #17 canceled with stage
......@@ -26,7 +26,6 @@ RUN apt-get update && apt-get install -y \
# Apache configuration
RUN a2enmod rewrite headers
COPY docker/000-default.conf /etc/apache2/sites-available/000-default.conf
# PHP configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
......@@ -47,10 +46,9 @@ RUN mkdir -p \
&& chown -R www-data:www-data /var/www/html/storage \
&& chmod -R 775 /var/www/html/storage
# Set Apache document root to public/
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
RUN sed -ri -e 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/*.conf \
&& sed -ri -e 's!/var/www/!/var/www/html/public!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# ─── Apache: Set DocumentRoot to /var/www/html/public ───
# Do NOT use sed — it causes double-path bugs. Use a clean vhost config instead.
COPY docker/000-default.conf /etc/apache2/sites-available/000-default.conf
# Entrypoint for DB initialization
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
......
......@@ -8,7 +8,9 @@ $dbConfig = require ROOT_PATH . '/config/database.php';
try {
$dsn = "mysql:host={$dbConfig['host']};port={$dbConfig['port']};dbname={$dbConfig['database']};charset={$dbConfig['charset']}";
$pdo = new PDO($dsn, $dbConfig['username'], $dbConfig['password'], $dbConfig['options']);
$options = $dbConfig['options'] ?? [];
$options[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = false;
$pdo = new PDO($dsn, $dbConfig['username'], $dbConfig['password'], $options);
} catch (PDOException $e) {
echo "DB Connection Failed: {$e->getMessage()}\n";
exit(1);
......
......@@ -8,7 +8,9 @@ $dbConfig = require ROOT_PATH . '/config/database.php';
try {
$dsn = "mysql:host={$dbConfig['host']};port={$dbConfig['port']};dbname={$dbConfig['database']};charset={$dbConfig['charset']}";
$pdo = new PDO($dsn, $dbConfig['username'], $dbConfig['password'], $dbConfig['options']);
$options = $dbConfig['options'] ?? [];
$options[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = false;
$pdo = new PDO($dsn, $dbConfig['username'], $dbConfig['password'], $options);
} catch (PDOException $e) {
echo "DB Connection Failed: {$e->getMessage()}\n";
exit(1);
......
......@@ -12,5 +12,7 @@ return [
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
PDO::ATTR_STRINGIFY_FETCHES => false,
// Disable SSL verification for internal Docker networking
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
],
];
\ No newline at end of file
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/public
ServerName localhost
<Directory /var/www/html/public>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
Options -Indexes +FollowSymLinks
# Route everything through index.php
FallbackResource /index.php
</Directory>
# Deny access to sensitive directories
<DirectoryMatch "/var/www/html/(engine|modules|config|database|cli|bootstrap|storage|docker|templates)">
Require all denied
</DirectoryMatch>
# Allow storage/uploads for file serving
<Directory /var/www/html/storage/uploads>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
......
This diff is collapsed.
......@@ -25,7 +25,15 @@ final class Connection
$this->config['database'],
$this->config['charset']
);
$this->pdo = new PDO($dsn, $this->config['username'], $this->config['password'], $this->config['options'] ?? []);
$options = $this->config['options'] ?? [];
// Ensure SSL cert verification is disabled for Docker internal networking
if (!isset($options[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT])) {
$options[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = false;
}
$this->pdo = new PDO($dsn, $this->config['username'], $this->config['password'], $options);
}
return $this->pdo;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment