Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@
### Apache httpd
- [ ] Enable logging to APACHE_LOG_DIR (this folder is currently being created during build process, but not used by apache server)
- [X] Redirecting from /index.html to /
- [ ] https
- [ ] https support

### Java FCGI
- [ ] User input validayion
- [ ] Add support of responces with information about errors
18 changes: 17 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,20 @@ services:
- APACHE_LOG_DIR="/var/log/httpd-server/"
restart: on-failure
ports:
- "8080:80"
- "8080:80"
networks:
- internal_net

java-fastcgi:
container_name: fastcgi-server
build:
context: ./server/
restart: on-failure
depends_on:
- apache-httpd
networks:
- internal_net

networks:
internal_net:
driver: bridge
14 changes: 14 additions & 0 deletions httpd/conf/custom/apache-httpd-lab1.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@
AllowOverride AuthConfig FileInfo
</Directory>

# ==========================
# FastCGI server setup start
# ==========================

ProxyPass /fcgi-bin/ fcgi://fastcgi-server:55555/
ProxyPassReverse /fcgi-bin/ fcgi://fastcgi-server:55555/

<Location "/fcgi-bin/">
Require all granted
</Location>

# ==========================
# FastCGI server setup end
# ==========================

# ErrorLog /var/log/httpd-server/error.log
# CustomLog /var/log/httpd-server/access.log combined
Expand Down
4 changes: 2 additions & 2 deletions httpd/conf/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
#LoadModule remoteip_module modules/mod_remoteip.so
#LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
Expand Down
38 changes: 38 additions & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
10 changes: 10 additions & 0 deletions server/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions server/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions server/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions server/.idea/runConfigurations/Main.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions server/.idea/runConfigurations/build_lab1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions server/.idea/runConfigurations/install_lib.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions server/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions server/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
20 changes: 20 additions & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM openjdk:17-jdk-slim AS build

# copy maven confis
COPY pom.xml mvnw ./
COPY .mvn .mvn

# copy fastcgi lib
COPY lib lib

# mvnw (aka Apache Maven Wrapper) allows to acess maven simplier
RUN ./mvnw install:install-file -Dfile=./lib/fastcgi-lib.jar -DgroupId=com.fastcgi -DartifactId=fastcgi -Dversion=1.0 -Dpackaging=jar
RUN ./mvnw dependency:resolve

COPY src src
RUN ./mvnw clean package

FROM openjdk:17-jdk-slim
WORKDIR server
COPY --from=build target/*.jar server-1.0.jar
ENTRYPOINT ["java", "-DFCGI_PORT=55555", "-jar", "server-1.0.jar"]
43 changes: 43 additions & 0 deletions server/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.web1</groupId>
<artifactId>server</artifactId>
<version>1.0</version>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifest>
<mainClass>org.web1.Main</mainClass>
</manifest>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>shade-my-jar</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Binary file added server/lib/fastcgi-lib.jar
Binary file not shown.
Loading