Docker apache configuration - invalid command ProxyPass

45 views Asked by At

I have a docker configured server with PHP, MySQL, PhpMyAdmin and I have different websites to which I'm getting with different domain names with VirtualHosts. I have installed separately NodeJS and started working on some new project (not related to docker). I would like to use the Apache VirtualHost thing to point also some domain to my NodeJs app which is accessible via localhost:3000. I found out that I would need to use ProxyPass to point to the NodeJS app, and I keep finding that I should add a2enmod proxy and a2enmod proxy_http to my Dockerfile, however, the modes are not enabled even if I add to restart Apache or not. I always get this error when I try to use the configuration file for apache as I will show it in the following rows: "invalid command ProxyPass perhaps misspelled"

Dockerfile

FROM php:8.1-apache
RUN apt-get update && apt-get upgrade -y
RUN a2enmod rewrite && a2enmod ssl && a2enmod socache_shmcb && a2enmod proxy && a2enmod proxy_http
RUN docker-php-ext-install mysqli pdo pdo_mysql 

000-default.conf

#WORKING:
<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName someweb.com
    ServerAlias www.someweb.com
    DocumentRoot /var/www/html/someapp
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

#NOT WORKING:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName somenodeapp.com
    ServerAlias www.somenodeapp.com
    ProxyPass / http://localhost:3000/
   #I have tried with IP and some generic domain name, but the error is not about the link, but about the module.
</VirtualHost>
0

There are 0 answers