diff --git a/docker-compose.yaml b/docker-compose.yaml index d3e538d..645128f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,10 +1,22 @@ services: - apache-httpd: - container_name: httpd-server +# apache-httpd: +# container_name: httpd-server-apache +# build: +# context: ./httpd/ +# dockerfile: ./Dockerfile-apache +# args: +# - APACHE_LOG_DIR="/var/log/httpd-server/" +# restart: on-failure +# ports: +# - "8080:80" +# networks: +# - internal_net + + nginx-httpd: + container_name: httpd-server-nginx build: context: ./httpd/ - args: - - APACHE_LOG_DIR="/var/log/httpd-server/" + dockerfile: ./Dockerfile-nginx restart: on-failure ports: - "8080:80" @@ -17,7 +29,8 @@ services: context: ./server/ restart: on-failure depends_on: - - apache-httpd + # - apache-httpd + - nginx-httpd networks: - internal_net diff --git a/httpd/Dockerfile b/httpd/Dockerfile-apache similarity index 77% rename from httpd/Dockerfile rename to httpd/Dockerfile-apache index 555b51c..0319d6b 100644 --- a/httpd/Dockerfile +++ b/httpd/Dockerfile-apache @@ -6,7 +6,7 @@ COPY ./static/ /var/www/localhost/htdocs/static/ # add custom apache configs RUN mkdir -p /etc/apache2/conf-custom -COPY ./conf/custom/ /etc/apache2/conf-custom/ +COPY ./apache-conf/custom/ /etc/apache2/conf-custom/ # create logs directory (temporary disabled) ARG APACHE_LOG_DIR @@ -14,6 +14,6 @@ RUN mkdir -p ${APACHE_LOG_DIR} RUN chown www-data:www-data ${APACHE_LOG_DIR} # setup main apache configuration -COPY ./conf/httpd.conf /usr/local/apache2/conf/httpd.conf +COPY ./apache-conf/httpd.conf /usr/local/apache2/conf/httpd.conf EXPOSE 80 \ No newline at end of file diff --git a/httpd/Dockerfile-nginx b/httpd/Dockerfile-nginx new file mode 100644 index 0000000..0f7508b --- /dev/null +++ b/httpd/Dockerfile-nginx @@ -0,0 +1,7 @@ +FROM nginx:latest + +COPY /nginx-conf/httpd.conf /etc/nginx/conf.d/default.conf +COPY ./static/ /var/www/html/ + +EXPOSE 80 +#EXPOSE 443 \ No newline at end of file diff --git a/httpd/conf/custom/apache-httpd-lab1.conf b/httpd/apache-conf/custom/apache-httpd-lab1.conf similarity index 85% rename from httpd/conf/custom/apache-httpd-lab1.conf rename to httpd/apache-conf/custom/apache-httpd-lab1.conf index 4b9a4d7..d0cc1e2 100644 --- a/httpd/conf/custom/apache-httpd-lab1.conf +++ b/httpd/apache-conf/custom/apache-httpd-lab1.conf @@ -16,10 +16,10 @@ # FastCGI server setup start # ========================== - ProxyPass /fcgi-bin/ fcgi://fastcgi-server:55555/ - ProxyPassReverse /fcgi-bin/ fcgi://fastcgi-server:55555/ + ProxyPass /fcgi/ fcgi://fastcgi-server:55555/ + ProxyPassReverse /fcgi/ fcgi://fastcgi-server:55555/ - + Require all granted diff --git a/httpd/conf/httpd.conf b/httpd/apache-conf/httpd.conf similarity index 100% rename from httpd/conf/httpd.conf rename to httpd/apache-conf/httpd.conf diff --git a/httpd/nginx-conf/httpd.conf b/httpd/nginx-conf/httpd.conf new file mode 100644 index 0000000..de90b04 --- /dev/null +++ b/httpd/nginx-conf/httpd.conf @@ -0,0 +1,18 @@ +server { + listen 80; + + root /var/www/html; + + # Обработка статических файлов + location / { + try_files $uri $uri/ =404; + } + + location /fcgi/ { + # Базовые настройки FastCGI + include fastcgi_params; + + # Адрес FastCGI сервера + fastcgi_pass fastcgi-server:55555; + } +} \ No newline at end of file diff --git a/httpd/static/index.html b/httpd/static/index.html index 330cf34..d4f7339 100644 --- a/httpd/static/index.html +++ b/httpd/static/index.html @@ -666,7 +666,29 @@

История введенных данных

const Y = document.getElementById('Y').value; if (X && R && Y) { - sendAJAXGETRequest("/fcgi-bin/", {"x": X, "y": Y, "r": R}, (resp) => {FFCGIResponceHandler(resp, X, Y, R)}); + + // Stub + sendAJAXGETRequest("/fcgi/", {"x": X, "y": Y, "r": R}, (data) => {console.log(data)}); + console.log(`Данные отправлены!\nX: ${X}\nY: ${Y}\nR: ${R}`); + + // Сохраняем данные в историю + const formData = { + timestamp: new Date().toISOString(), + X: X, + Y: Y, + R: R, + elapsedTimeMs: 100, + isHitted: true + }; + + formHistory.push(formData); + localStorage.setItem('formHistory', JSON.stringify(formHistory)); + + // Обновляем таблицу + refreshHistoryTable(); + + // Обновляем график + refreshGraph(); // Очищаем форму this.reset(); diff --git a/server/.idea/misc.xml b/server/.idea/misc.xml index 82dbec8..b2eea27 100644 --- a/server/.idea/misc.xml +++ b/server/.idea/misc.xml @@ -1,14 +1,7 @@ - - - - + \ No newline at end of file