dauren101
@dauren101
Python, Django ,Vue.js

Location в nginx не работает?

На xampp apache такой .htaccess, он работает, но при переноса на сервер на ngninx ссылки не открываются, т.е просто остается на главной странице, хотя ссылки в url меняются.
AddDefaultCharset UTF-8
Options -MultiViews
RewriteEngine on

RewriteBase /

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
 
# otherwise forward it to index.php
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]


Это конфиг nignx
server {
        listen 80;
        server_name devastu.kaz.kz;
        client_max_body_size 10m;
        client_body_buffer_size 256k;
        access_log /var/log/nginx/devastu.kaz.kz-access.log main;
        error_log /var/log/nginx/devastu.kaz.kz-error.log notice;
        log_not_found off;
        root   /home/d.shalabayev/www/astu/public;
        index index.php;

         location / {
                # Redirect everything that isn't a real file to index.php
                 try_files $uri $uri/ /index.php$is_args$args;

        }
        location ~ \.php$ {
            #limit_req   zone=one  burst=2;
            fastcgi_connect_timeout 600;
            fastcgi_send_timeout 600;
            fastcgi_read_timeout 600;
            fastcgi_pass   unix:/var/run/php-fpm-www.sock;
            fastcgi_index  index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
        }
        location ~* /\. {
                deny all;
        }

    }
  • Вопрос задан
  • 539 просмотров
Пригласить эксперта
Ответы на вопрос 1
В корневую локацию добавте

rewrite ^(.+)$ /index.php?url=$1 break;
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы