G
G
Galdar Turin2019-12-11 12:09:29
Nginx
Galdar Turin, 2019-12-11 12:09:29

How to specify the path to a new directory?

Such a problem, I want to make a transition to the directory with the opening of index.html ( dev.ru/temp/ ) in it - the path /var/www/b/c/
I write like this

server {
  server_name dev.ru;
  
  listen 80 default_server;

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

  location / {
    try_files $uri $uri/ /index.php?q=$uri & $args;
  }

  location /temp/ {
    alias /var/www/b/c/;
  }

But it throws an error:
Mistake
HTML-документ не содержит объявления кодировки символов. Если документ содержит символы, не входящие в диапазон US-ASCII, то в некоторых конфигурациях браузера в документе будет отображён искажённый текст. Кодировка символов страницы должна быть объявлена в документе или в протоколе передачи.

I set the rights to the index file, but it still does not open it, it says "GET / HTTP/1.1" in the logs 403 153

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Galdar Turin, 2019-12-11
@Galdar

Decision

location ~ ^/temp/(.*) {
    alias /var/www/b/c/$1;
  }

O
O. J, 2019-12-11
@OrlovEvgeny

you have in index.html which is in temp, the encoding is not specified or is not defined. Look at what encoding you have all html in, or try adding it to nginx.conf.
If it doesn't work, post the one in which you have all the files

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question