nginx

4 readers
1 users here now

The nginx community on Reddit. Reddit gives you the best of the internet in one place.

founded 1 year ago
MODERATORS
76
 
 
The original post: /r/nginx by /u/Ana4doves on 2024-08-07 18:49:39.

Good day everyone!

I have been searching everywhere for an IMAP proxy I can actually configure and use. I tried Dovecot, Courier and Cyrus, and probably for the lack of my techincal skills but I cannot piece together the elements to configure an IMAP proxy, figuratively and literally.

So far NGINX has been the most promising, actually having a guide on how to configure and set up the service. Sadly I simply cannot get it to work. NGINX says to compile it yourself with

./configure --with-mail --with-mail_ssl_module --with-openssl=[DIR]/openssl-1.1.1

and my first problem was with OpenSSL. First of all I tried on Debian 12 where I could not for the life of me compile OpenSSL and at that point I decided to check what OS if recommended for NGINX and I went with Alpine.

I managed to compile OpenSSL in Alpine ignoring what the guide said to use

./Configure darwin64-x86_64-cc --prefix=/usr

because using "darwin64-x86_64-cc" resulted in the make command erroring, saying it doesnt recognize "-arch" (In Debian too). So i simply ran "./configure --prefix=/usr" and it was successful.

Then came compiling NGINX. My problem was the "--with-openssl=[DIR]/openssl-1.1.1". No "openssl-1.1.1" directory exists. Took me too long to figure out but with that prefix option I actually set for OpenSSL to be there.

So when I tried to compile NGINX, run the ./configure with the parameters and openssl pointing to that /usr/ssl directory, it errors out, saying it cannot find a ./configure file. So out of curiosity I set the openssl parameter to point at the extracted, configured, made and made installed openssl-1.1.1v folder and it ran for a good 15 minutes , it looked like its compiling OpenSSL again, but after its done giving out the "nginx" command does nothing.

I have been trying this for the third day in a row, sitting over compile screens, setting up VM's and Im burned out. My only purpose for this is to send/recieve mail from an old hobby phone I got. Postfix was so easy to set up to send mail, Im stumped on this. The guides Im looking at are:

https://docs.nginx.com/nginx/admin-guide/mail-proxy/mail-proxy/

https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#sources

Can anyone help me or point out what Im doing wrong, maybe suggest another OS or IMAP proxy? I take this as a learning project for Linux in general, but I really do need help with this.

Thank you for your time!

77
 
 
The original post: /r/nginx by /u/_shashank_bhake on 2024-08-07 18:37:43.

I have 2 services running in my docker, /app1 and /app2. I setup my nginx reverse proxy for the services on port 80.

But for some reason, the Request URL is without the /app2/ part.

For example,

If I request http://localhost/app2/files, it just redirects to http://localhost/files and I see 404 in my logs.

Is it because the /files is a directory that contains my files?

BTW, when i request http://localhost/app2/files/photo.png, I get my file correctly. But the file is not requested properly in the nginx reverse proxy.

Please find my config below and suggest me how to fix it :)

PS: The server works perfectly when I run it on main port (not the nginx proxy).

My nginx.conf:

server {
    listen 80;
    server_name localhost;

    location / {
        root /usr/share/nginx/html;
    }
    location /app1/ {
        proxy_pass http://app1:8080/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
    location /app2/ {
        proxy_pass http://app2:3000/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

78
 
 
The original post: /r/nginx by /u/pixbalance on 2024-08-07 10:56:47.

How can I use a custom 403 page in NGINX running as docker under Unraid? I could not find the /data/nginx/custom/server_proxy.conf in the apps dir.

79
 
 
The original post: /r/nginx by /u/Jolly-Temperature-63 on 2024-08-07 09:01:00.

I used this config file to host a frontend project

backend is also running on the same server but i haven't hosted and it is running http://localhost:3000

when i try to access the frontend i get "locked loading mixed active content"

server {

listen 14800 ssl;

server_name x.x.x.x;

ssl_certificate /etc/nginx/certs/server.crt;

ssl_certificate_key /etc/nginx/certs/server.key;

root /var/www/eticket-admin;

index index.html index.htm index.nginx-debian.html;

location / {

try_files $uri $uri/ =404;

try_files $uri $uri/ /index.html;

}

}

80
 
 
The original post: /r/nginx by /u/SubjectLook4519 on 2024-08-06 14:39:39.

Hello,

its possible to set in Plesk Nginx (reverse proxy) for multiple backends?

I find many webpages for set it, like:

https://www.bodhost.com/kb/how-do-to-set-up-nginx-as-a-reverse-proxy-in-plesk/

But this is only for 1 backend server.

I try this setting in every domain settings, but no luck:

https://snipboard.io/a8uLIT.jpg

81
 
 
The original post: /r/nginx by /u/Emergency-Complex753 on 2024-08-06 13:54:52.

My Setup is: Im On Windows 10.

php - version : PHP Version 7.4.10 /// tested already with 8.

nginx - version : nginx/1.27.0

script that Im using for upload : https://github.com/danielm/uploader/tree/master

All configs in php.ini and nginx.conf are set to maximum upload, like: memory_limit = 512M,max_execution_time = 3600,upload_max_filesize = 16G, and client_max_body_size 4G;

(maybe i need to activate some tricky option)

The problem : i see the big file in temp temp folder(full size), from nginx but it can't be passed to php, to the final distanation,

I Can't upload more THAT 2GB 1GB file upload - it's ok

2.2_bad.raw - Status: Bad Request ( exact size of file 2,14 GB (2.306.867.200 bytes) )

I have already noticed if i replace the server "nginx" with server "Apache" and i keep the same server php-cgi.exe I don't have the same problem for file upload (all uploads ok)

on my internal network on my NAS , I have +- the same config but im on Linux SYSTEM, (i can paste info from php if needed) , and there i don't have any limit to upload my files

==> Im wondering if it is possible to do on Windows with (php + nginx) ==> Or Nginx is limited somewhere ?

82
 
 
The original post: /r/nginx by /u/andy_why on 2024-08-06 10:58:06.
83
 
 
The original post: /r/nginx by /u/AggressiveDuck6739 on 2024-08-06 06:11:18.

Hi, I have setup my code to have my nginx config listen or 80 and have my gunicorn on 8080. I then have my local to my 5000. Can anyone provide me some insights on what is wrong? I can post my code later but any tips would be helpful.

Nginx file

upstream gunicorn { server 127.0.0.1:8080; }

server { listen 80; server_name - fantasychamps

location / {
    proxy_pass http://gunicorn;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

}

Procfile

web: gunicorn --bind 0.0.0.0:8080 application:app

84
 
 
The original post: /r/nginx by /u/Natural_Function on 2024-08-05 14:48:31.

Hello everyone,

I have a question about NGinx Proxy Manager: I am running a Synology DiskStation with the Web Station. I need the Web Station for other purposes. However, the Proxy Manager requires the same ports that the Web Station uses.

At the same time, I also have a small Proxmox server here. Can I install the Proxy Manager on it and have it point to the DiskStation, or am I missing something in my thinking?

85
 
 
The original post: /r/nginx by /u/Armed_Muppet on 2024-08-04 17:38:17.
86
 
 
The original post: /r/nginx by /u/elasticsearch_help on 2024-08-03 02:51:18.

I am using CentOS 7, just wondering if it is possible to apply the Nginx that they are using in this video to my system (following what they did doesn't seem to be working):

https://www.youtube.com/watch?v=tDC8IE3qO9w

87
 
 
The original post: /r/nginx by /u/Rough-Day3810 on 2024-08-02 18:50:04.

how I can have a good all Channel TV live streaming using with high quality and no access Non-Stop

88
 
 
The original post: /r/nginx by /u/NotAVirignISwear on 2024-08-02 07:03:43.

I'm hoping that someone here can help me out, because I've been banging my head against a wall for hours with no luck. The breakdown is below:

Remote Server: Ubuntu 24.04

Remote Server LAN IP: 10.0.1.252

Remote Server WAN IP: xxx.xxx.xxx.xxx

VPS: Oracle Linux 7.9

VPS WAN IP: yyy.yyy.yyy.yyy

VPS is running nginx with this config:

user nginx;
stream {
    upstream minecraft {
       server ;
    }

    server {
        listen 25565;
        proxy_pass minecraft;
    }

    server {
        listen 25565 udp;
        proxy_pass minecraft;
    }
}xxx.xxx.xxx.xxx:25565

All traffic received on port 25565 (TCP or UDP) is sent through the reverse proxy, pointed to the remote server.

This currently works, but the remote server loses the original client IP address and instead, all packets show as being from yyy.yyy.yyy.yyy. If I use

user root;
stream {
    upstream minecraft {
       server ;
    }

    server {
        listen 25565;
        proxy_pass minecraft;
        proxy_bind $remote_addr transparent;
    }

    server {
        listen 25565 udp;
        proxy_pass minecraft;
        proxy_bind $remote_addr transparent;
    }
}xxx.xxx.xxx.xxx:25565

I can no longer connect to the application on the remote host due to timeouts. Nothing appears in /var/log/nginx/error.log, so I'm not sure what the issue is. ChatGPT hasn't been super helpful, but I did read online here that iptables rules were needed to ensure packets returned from the remote server were sent to the reverse proxy. My issue is this part:

On each upstream server, remove any pre‑existing default route and configure the default route to be the IP address of the NGINX Plus load balancer/reverse proxy. Note that this IP address must be on the same subnet as one of the upstream server’s interfaces.

(at least I assume) because my remote server is on a different network than the reverse proxy.

Any ideas on what I'm trying to do is even possible? I'm new to nginx so I'm just trying whatever I can find hoping something works.

Edit: If I connect the VPS to the remote server via a VPN and then change the nginx upstream server to the internal IP address of the remote server, would that solve the issue with the default route between the VPS and remote server not being on the same subnet?

89
 
 
The original post: /r/nginx by /u/hacktek on 2024-08-02 01:56:34.

subject

I have a caching proxy at home pulling content from a very far away server (over 200ms) so my throughout is latency bound. I'd like to send multiple slice requests in parallel to increase it. Is that possible? I found a 10 year module to parallelize range requests and compiled nginx with it, but it does not work properly and the maintainer has no interest in improving it since it's an old proof of concept.

Thanks

90
 
 
The original post: /r/nginx by /u/elasticsearch_help on 2024-08-02 01:02:56.

What I want to see if possible is to split the config into multiple files as so:

  1. ELK Stack at http://localhost:5601

  2. Rocket.Chat at http://localhost:3000 - Not yet added

Is this possible?

This is my current nginx config on CentOS 7:

server {

listen 80;

listen 443 ssl;

server_name ELK.uhtasi.local;

auth_basic "Restricted Access";

auth_basic_user_file /etc/nginx/htpasswd.users;

ssl_certificate /etc/nginx/ELK.uhtasi.local.crt;

ssl_certificate_key /etc/nginx/ELK.uhtasi.local.key;

ssl_session_cache shared:SSL:1m;

ssl_session_timeout 10m;

ssl_ciphers HIGH:!aNULL:!MD5;

ssl_prefer_server_ciphers on;

location / {

proxy_pass http://localhost:5601;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection 'upgrade';

proxy_set_header Host $host;

proxy_cache_bypass $http_upgrade;

# Add cache control headers

add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";

add_header Pragma "no-cache";

}

location /home {

proxy_pass http://localhost:3000;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection 'upgrade';

proxy_set_header Host $host;

proxy_cache_bypass $http_upgrade;

# Add cache control headers

add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";

add_header Pragma "no-cache";

}

location /app/management {

#auth_basic "Restricted Access";

#auth_basic_user_file /etc/nginx/forbidden.users;

proxy_pass http://localhost:5601;

proxy_read_timeout 90;

limit_except GET {

deny all;

}

# Only allow access to "roman" and "alvin"

if ($remote_user !~* ^(roman|alvin)$) {

return 403; #Forbidden for all other users

}

# Add cache control headers

add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";

add_header Pragma "no-cache";

}

location /app/dev_tools {

proxy_pass http://localhost:5601;

proxy_read_timeout 90;

limit_except GET {

deny all;

}

# Only allow access to "roman" and "alvin"

if ($remote_user !~* ^(roman|alvin)$) {

return 403; #Forbidden for all other users

}

# Add cache control headers

add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";

add_header Pragma "no-cache";

}

}

91
 
 
The original post: /r/nginx by /u/National_Cut7360 on 2024-07-31 09:46:23.

Hello Nginx Community,

I'm currently exploring the setup of GoAccess as a container within my k8s, specifically with the nginx-ingress Controller (not ingress-nginx). I'm looking for insights or shared experiences on the best practices for this setup.

  1. Log Management: What are the best practices for accessing and managing Nginx logs in this scenario? Considering the logs are generated by the Nginx Ingress Controller, how do you efficiently pass them to the GoAccess container?
  2. Storing Reports: I'm considering options for storing the generated reports. Would storing them on a persistent volume be the best approach, or are there more efficient methods?
  3. Accessing Reports: What methods are recommended for securely accessing these reports? Should I consider an internal dashboard, or are there better alternatives?

If anyone here has tackled these issues or has running configurations they're willing to share, I'd greatly appreciate your insights!

Thank you!

92
 
 
The original post: /r/nginx by /u/_Arelian on 2024-07-29 18:43:18.

I have a docker container running nginx as a reverse proxy, in my nginx.conf file I have the following configuration

upstream portainer-web {
    server portainer:9000;

}

server {

    listen 80;
    listen [::]:80;

    server_name portainer.192.168.2.20 portainer.localhost portainer.my-domain.com;

    location / {
        proxy_pass http://portainer-web;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
        proxy_ssl_server_name on;
    }
}

upstream pihole-web {
    server pihole:80;
}

server {

    listen 80;
    listen [::]:80;

    server_name pihole.192.168.2.20 pihole.localhost pihole.my-domain.com;
    location / {
        proxy_pass http://pihole-web;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
        proxy_ssl_server_name on;
    }
}

when I access my my-domain.com, portainer shows up but that does not make sense since there is no configuration for that service on that port.

I know I can just add another configuration for port 80 to display an error, however, I do not understand why it serves portainer on that port, any ideas why?

93
 
 
The original post: /r/nginx by /u/ThibauDefi on 2024-07-29 09:52:14.

Can you help me configuring my Nginx RTMP server and/or the FFMPEG transcoding settings

I made a IRL backpack for streaming which works as follow :

  1. GoPro stream via wifi h264 to local hotspot >
  2. Local hotspot host on Raspberry with local Nginx RTMP server >
  3. Raspberry bonding 4 cellular connection >
  4. Raspberry RTMP with ffmpeg push to remote Nginx RTMP >
  5. OBS on home computer read remote Nginx RTMP and stream to Twitch.

Works great until my connection drops a little bit, then the stream drops frames and audio cut with dropped frames. Unfortunately I have to restart the Rasp Nginx and gopro streaming to make it back to normal. You can see on this video at 24min : https://www.twitch.tv/videos/2207900898?t=00h24m09s

Is there any way to increase stability even if it must create delay in the live streaming ? Or at least make it come back to normal when network come back to normal ? (like a resync or something else ?)

Thanks you so much for any help !

I tried to find information on FFMPEG or RTMP about this kind of problem but without any success...


RTMP CONFIG

local (Raspberry - RaspbianOS) Nginx rtmp.conf:

rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application push {
            live on;
            record off;
            publish_notify on;
            drop_idle_publisher 10s;
            exec ffmpeg
                -re -hide_banner
                -i rtmp://127.0.0.1:1935/push/$name
                -c:v copy
                -c:a copy
                -f flv rtmp://remote.rtmp.address:1935/push/$name;
        }
    }
}

remote (VPS - Ubuntu) Nginx rtmp.conf :

rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application push {
            live on;
            record off;
            publish_notify on;
            play_restart on;
            drop_idle_publisher 10s;
        }
    }
}

94
 
 
The original post: /r/nginx by /u/iCeD00D on 2024-07-28 02:27:00.

Good evening. I'm a streamer and use OBS on my main computer. I have a seperate computer that has NGINX configured to push my streams to twitch and youtube. No problems. I just started on Kick and was in the configuration file but I cant figure out the proper way to push to Kick. Instead of RMTP like youtube and twitch its RMTPS. I've tried the Push command and even without out it (the twitch and youtube have it configured that way) with no luck. Anyone know the way to add Kick to the configure file? Examples would be great. Thanks in advance.....

95
 
 
The original post: /r/nginx by /u/Administrative-Air73 on 2024-07-27 10:07:25.

New to this kinda work, and was setting up my DXP4800-PLUS NAS with Nginx and Cloudflare following this tutorialand noticed I got an Internal Error when attempting to generate a SSL Certificate. Checking the logs I get the results below.

OS: UGOS (Ugreen fork of Debian)

Hosting provider: Cloudflare

Use Case: Jellyfin Server | Obsidian Live Sync

Error: Command failed: . /opt/certbot/bin/activate && pip install --no-cache-dir certbot-dns-cloudflare==$(certbot --version | grep -Eo '0-9+') cloudflare && deactivate

An unexpected error occurred:

ModuleNotFoundError: No module named 'CloudFlare'

Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /tmp/certbot-log-t1p6kngl/log or re-run Certbot with -v for more details.

ERROR: Ignored the following versions that require a different python version: 2.10.0 Requires-Python >=3.8; 2.11.0 Requires-Python >=3.8; 2.8.0 Requires-Python >=3.8; 2.9.0 Requires-Python >=3.8

ERROR: Could not find a version that satisfies the requirement certbot-dns-cloudflare== (from versions: 0.14.0.dev0, 0.15.0, 0.16.0, 0.17.0, 0.18.0, 0.18.1, 0.18.2, 0.19.0, 0.20.0, 0.21.0, 0.21.1, 0.22.0, 0.22.1, 0.22.2, 0.23.0, 0.24.0, 0.25.0, 0.25.1, 0.26.0, 0.26.1, 0.27.0, 0.27.1, 0.28.0, 0.29.0, 0.29.1, 0.30.0, 0.30.1, 0.30.2, 0.31.0, 0.32.0, 0.33.0, 0.33.1, 0.34.0, 0.34.1, 0.34.2, 0.35.0, 0.35.1, 0.36.0, 0.37.0, 0.37.1, 0.37.2, 0.38.0, 0.39.0, 0.40.0, 0.40.1, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.9.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.13.0, 1.14.0, 1.15.0, 1.16.0, 1.17.0, 1.18.0, 1.19.0, 1.20.0, 1.21.0, 1.22.0, 1.23.0, 1.24.0, 1.25.0, 1.26.0, 1.27.0, 1.28.0, 1.29.0, 1.30.0, 1.31.0, 1.32.0, 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4)

ERROR: No matching distribution found for certbot-dns-cloudflare==

[notice] A new release of pip is available: 23.3.2 -> 24.0

[notice] To update, run: pip install --upgrade pip

at ChildProcess.exithandler (node:child_process:402:12)

at ChildProcess.emit (node:events:513:28)

at maybeClose (node:internal/child_process:1100:16)

at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)

96
1
cgi 403 issue (zerobytes.monster)
submitted 3 months ago by [email protected] to c/[email protected]
 
 
The original post: /r/nginx by /u/5calV on 2024-07-26 22:14:58.

Hi, I hope someone here can help me, I don't know what to try anymore tbh.

I am trying to use cgi with fcgiwrap and nginx on a Debian Stable host.

Finding the correct setup for this was already a hustle! Now I got another problem:

I can access my index.html just fine over the browser, but when trying to access the shell script in the browser I get a 403.

I already tried to recursively 777 /var/www, just to test it out, without any luck. In my www directory the are two nested directories: "html" with an index.html, and "cgi-bin" with my shell script.

My nginx error log says this:

2024/07/26 23:55:49 [error] 3771#3771: *1 FastCGI sent in stderr: "Cannot get script name, are DOCUMENT_ROOT and SCRIPT_NAME (or SCRIPT_FILENAME) set and is the script executable?" while reading response header from upstream, client: 10.10.10.52, server: testserver, request: "GET /cgi-bin/hello.sh HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "IP"

This is my nginx config:

server {
    listen 80;
    server_name testserver;

    root /var/www/html;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }

    location /cgi-bin/ {
        alias /var/www/cgi-bin/;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /var/www/cgi-bin$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT /var/www/html;
    }

I really hope someone can help me here. If you got ANY other idea on how to execute bash scripts on the host via HTML / Nginx, feel free to tell me about it! Also, should I switch to Apache / httpd? cgi seems to work much simpler with it?

Thank you for reading this far! :)

97
 
 
The original post: /r/nginx by /u/icedmachinery on 2024-07-26 20:15:40.

I have no idea what I'm doing but decided to mess around with nginx for a little bit to see if I can figure this stuff out. I installed Nginx but when I go to my public ip in the browser it just loads forever and doesn't bring up the nginx page :( I've been trying to figure this out for a day now and it's been pretty stressful and I feel like I'm totally stupid lmao

98
 
 
The original post: /r/nginx by /u/RespectibleCabbage on 2024-07-26 10:04:38.

I have a new router in the new place (and a new IP of course), so I set up port forwarding to the new IP, I changed my IP at Cloudflares end, but I just get timeouts when I try and access the site.

The ngnix config passes, I don't see anything in the error or access logs. Do I need to generate a new CF origin certificate (I can't remember if that's got anything to do with your IP :D)

Thanks everyone

99
1
Tweeking nginx (zerobytes.monster)
submitted 3 months ago by [email protected] to c/[email protected]
 
 
The original post: /r/nginx by /u/LucasRey on 2024-07-26 04:23:02.

Hello, some days ago I instantiate my first nginx server at home on Ubuntu 24.04 LTS. It's used as reverse proxy for my home services (e.g. immich, nextcloud, authentik, etc..). Now I'm surfing on official documentation, and around on the web, to study how to tweek it. Performance and security is my priority.

I found several directives to add to the config, what is not clear to me is where to add those settings.

Just as example, this: server_tokens off; will minimizing the amount of data that is revealed to potential attackers

Now, where I have to configure such values (and others)? At main config? /etc/nginx/nginx.conf

Or on each available sites under /etc/nginx/sites-enabled/?

Thank you

Lucas

100
 
 
The original post: /r/nginx by /u/yukiiiiii2008 on 2024-07-25 17:41:17.

After adding a location block to serve fonts, it suddenly gives me this error.

default.conf

server {
    listen       9003;
    server_name  localhost;

    # I add this location block to default, it suddenly stop to work and give me the error
    location ~* \.(eot|ttf|woff|woff2|svg)$ {
        add_header Access-Control-Allow-Origin *;
    }

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

view more: ‹ prev next ›