T
T
Timur Mammadov2021-12-15 00:48:23
Nginx
Timur Mammadov, 2021-12-15 00:48:23

Where to inject Nginx script into OpenServer?

I need this code:

location ~* ^.+\.(webp|jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpeg|avi|zip|gz|bz2|rar|swf|ico|mp4)$ {
  valid_referers none blocked domain.tld ~\.google\. ~\.yandex\.;
    if ($invalid_referer) {
      return 403;
    } 
}

Paste into the nginx config ("D:\openserver\modules\http\Apache_2.4-PHP_7.2-7.4+Nginx_1.17\conf\nginx.conf")
But the problem is that the config is temporary, that is, it is updated every times after server restart.

Actually the question is:
- How and where to enter this script so that it is saved?

Please help with the problem (
I will provide all the additional information

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Timur Mammadov, 2021-12-16
@TimurWiFi

I'll answer my own question:
Here - "D:\OpenServer\userdata\config\Apache_2.4-PHP_7.2-7.4+Nginx_1.17_vhostn.conf" Choose
Apache depending on the selected module

A
Alexey Dmitriev, 2021-12-15
@SignFinder

In a separate conf file, which should be included in the main conf file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question