diff --git a/Dockerfile b/Dockerfile index 75a0ab7..13fec88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,31 @@ FROM php:8.1.7-apache -### Install surpervisor ### RUN apt-get update -y -RUN apt-get install -y supervisor unzip git vim +RUN apt-get install -y supervisor unzip vim RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql RUN curl -sS https://getcomposer.org/installer -o composer-setup.php RUN HASH=`curl -sS https://composer.github.io/installer.sig` RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer +RUN mkdir /var/www/public +#config supervisord RUN mkdir -p /var/www/html/ /var/log/supervisor COPY supervisord.conf /etc/supervisor/supervisord.conf -COPY apache2.conf /etc/apache2/apache2.conf -COPY .htaccess /var/www/ +#config apache +COPY apache/apache2.conf /etc/apache2/apache2.conf +COPY apache/revers_proxy.conf /etc/apache2/conf-available/revers_proxy.conf +COPY apache/.htaccess /var/www/public/ +COPY apache/.htaccess_public /var/www/ +RUN a2enconf revers_proxy RUN a2enmod rewrite RUN a2enmod actions -## CONFIGURANDO AMBIENTE WEB ## +RUN a2enmod proxy proxy_http +#config composer WORKDIR /var/www/public -RUN git config --global user.email "desenvolvimento@simplesip.com.br" -RUN git config --global user.name "Desenvolvimento" COPY . /var/www/public RUN rm -rf composer.lock RUN rm -rf vendor RUN composer install EXPOSE 80 -#CMD supervisord -n -c /etc/supervisor/supervisord.conf +CMD supervisord -n -c /etc/supervisor/supervisord.conf #CMD [ "/usr/sbin/httpd", "-D", "FOREGROUND" ] \ No newline at end of file diff --git a/.htaccess b/apache/.htaccess similarity index 100% rename from .htaccess rename to apache/.htaccess diff --git a/apache/.htaccess_public b/apache/.htaccess_public new file mode 100644 index 0000000..f00d481 --- /dev/null +++ b/apache/.htaccess_public @@ -0,0 +1,3 @@ +RewriteEngine on +RewriteRule ^$ public/ [L] +RewriteRule (.*) public/$1 [L] \ No newline at end of file diff --git a/apache2.conf b/apache/apache2.conf similarity index 99% rename from apache2.conf rename to apache/apache2.conf index 3ead4f2..4156193 100644 --- a/apache2.conf +++ b/apache/apache2.conf @@ -224,4 +224,4 @@ IncludeOptional conf-enabled/*.conf # Include the virtual host configurations: # IncludeOptional sites-enabled/*.conf -# vim: syntax=apache ts=4 sw=4 sts=4 sr noet +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet \ No newline at end of file diff --git a/apache/revers_proxy.conf b/apache/revers_proxy.conf new file mode 100644 index 0000000..b93ee7f --- /dev/null +++ b/apache/revers_proxy.conf @@ -0,0 +1,17 @@ + + ProxyRequests On + + + Require all granted + + + ProxyVia On + + + CacheEnable disk / + CacheRoot "/var/cache/mod_proxy" + + ProxyPass /wss ws://127.0.0.1:8080/ws + ProxyPassReverse /wss wss://127.0.0.1:8080/ws + + diff --git a/supervisord.conf b/supervisord.conf index 5b8add6..074544e 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -1,13 +1,11 @@ [supervisord] nodaemon=true -user=root [program:apache2] -command=service apache2 start -redirect_stderr=true +command=apache2-foreground [program:test_services] -command=php /var/www/tests/test_services.php +command=php /var/www/public/tests/test_services.php [program:websocket] -command=php /var/www/websocket/websocket.php \ No newline at end of file +command=php /var/www/public/websocket/websocket.php \ No newline at end of file