Replace Apache with Nginx

This commit is contained in:
Maciej Pędzich 2024-07-26 16:53:59 +02:00
parent 4841f7f5b0
commit f846efc226
Signed by: maciejpedzich
GPG Key ID: CE4A303D84882F0D
3 changed files with 13 additions and 21 deletions

View File

@ -4,7 +4,8 @@ COPY . .
RUN npm i RUN npm i
RUN npm run build RUN npm run build
FROM httpd:2.4-alpine AS runtime FROM nginx:stable-alpine AS runtime
COPY --from=build /app/httpd.conf /usr/local/apache2/conf/httpd.conf COPY --from=build /app/nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/local/apache2/htdocs/ COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,18 +0,0 @@
ServerName racemash.maciejpedzi.ch
LoadModule mpm_event_module modules/mod_mpm_event.so
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
#LoadModule mpm_worker_module modules/mod_mpm_worker.so
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>

9
nginx/default.conf Normal file
View File

@ -0,0 +1,9 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
}