nginxinc / docker-nginx

Official NGINX Dockerfiles
BSD 2-Clause "Simplified" License
3.15k stars 1.72k forks source link

Angular 15 unexpected "}" in /etc/nginx/nginx.conf:10? #861

Open kapil26021994 opened 5 months ago

kapil26021994 commented 5 months ago

Describe the bug

I have deployed angular file with docker and nginx file but from harness pipeline CI done but CD got issue and in the CD i have added my nginx file as well as error image can anybody help on that regarding that issue i am stuck this issue last 4 days can you help me please ?

Docker file `FROM artifactorycloud.ual.com/v-docker/node:16-alpine3.16 as build WORKDIR /usr/src/app ENV PATH /app/node_modules/.bin:$PATH COPY package*.json ./ RUN npm install -g @angular/cli@15.2.10 RUN echo $WORKDIR COPY . . RUN npm run build

RUN ls -ltr /usr/src/app/dist/isa FROM nginx:alpine COPY ./config/nginx.conf /etc/nginx/nginx.conf WORKDIR /usr/share/nginx/html COPY --from=build /usr/src/app/dist/isa/ . EXPOSE 4200`

To reproduce

Steps to reproduce the behaviour: worker_processes auto;

events { worker_connections 1024; }

http { server { listen 0.0.0.0:80; listen [::]:80; default_type application/octet-stream;

# Gzip Settings
gzip                    on;
gzip_comp_level         6;
gzip_vary               on;
gzip_min_length         1000;
gzip_proxied            any;
gzip_types              text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers            16 8k;
client_max_body_size    256M;

# Brotli Settings
# brotli on;
# brotli_comp_level 4;
# brotli_buffers 32 8k;
# brotli_min_length 100;
# brotli_static on;
# brotli_types image/jpeg image/bmp image/svg+xml text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon;

root /usr/share/nginx/html;

#added for security issues
server_tokens off;

location / {
    #added for security issues
    proxy_pass_header Server;

    try_files $uri $uri/ /index.html =

} } }

Expected behavior

Fix above error and deploy build

Additional context

Anybody can you help me regarding this issue please let me know?

maxim-avramenko commented 5 months ago

Maybe extra "=" in try_files $uri $uri/ /index.html =

Try

try_files $uri $uri/ /index.html;

kapil26021994 commented 5 months ago

@maxim-avramenko i have tried ur solution but still same issue exist can you check my updated docker file also?

indapublic commented 5 months ago

@kapil26021994 Your nginx config is incorrect, you can check it via nginx -t or here

kapil26021994 commented 5 months ago

@indapublic here we will put my nginx.conf file content correct?

indapublic commented 5 months ago

@kapil26021994 Yep

kapil26021994 commented 5 months ago

@indapublic thanks for the update and issue fixed now but now i get new error can you please check and let me know what the issue now:

2024/01/25 15:21:18 [notice] 1#1: start worker process 30
2024/01/25 15:21:18 [notice] 1#1: start worker process 29
2024/01/25 15:21:18 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 65535:65535
2024/01/25 15:21:18 [notice] 1#1: built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r10)
Jan 25 20:51:18.317 2024/01/25 15:21:18 [notice] 1#1: nginx/1.25.3
Jan 25 20:51:18.307  /docker-entrypoint.sh: Configuration complete; ready for start up
Jan 25 20:51:18.300   /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
Jan 25 20:51:17.78    /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
Jan 25 20:51:17.776  /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
Jan 25 20:51:17.776 /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
Jan 25 20:51:18.300  /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
thresheek commented 3 months ago

Hi @kapil26021994, there are no issues in this output.