nginx как настроить ?

Discussion in 'Болталка' started by guest11, 14 Oct 2024.

  1. guest11

    guest11 Member

    Joined:
    4 Dec 2018
    Messages:
    32
    Likes Received:
    5
    Reputations:
    0
    Code:
    server {
    listen 80 default_server;
    listen [::]:80 default_server;
    root /var/www/testsite.dev/html;
    
    
    
    location = / {
        root /var/www/testsite.dev/html;
    }
    
    
    location = /index.html {
        root /var/www/testsite.dev/html;
        expires 0;
      }
    
    
    location ~* ^.+\.(svg|eot|otf|woff|ttf|jpg|jpeg|gif|png|ico|bmp|css|js)$ {
    expires 7d;
    }
     
    
    
    server_name testsite.dev www.testsite.dev;
    index index.php index.html index.htm index.nginx-debian.html;
    location /phpmyadmin {
    alias /usr/share/phpmyadmin/;
    location ~ \.php$ {
    fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $request_filename;
    include fastcgi_params;
    fastcgi_ignore_client_abort off;
    }
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    access_log    off;
    log_not_found    off;
    expires 1M;
    }
    }
    location ~ \.php$ {
    fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
    }
    
    Главная страница сайта работает .
    Другие страници отдают ошибку 404

    что то с location ,
     
  2. guest11

    guest11 Member

    Joined:
    4 Dec 2018
    Messages:
    32
    Likes Received:
    5
    Reputations:
    0
    location / {
    try_files $uri $uri/ /index.php$is_args$args;
    }

    помогло теперь не видны изображения

    и еще настраивать virtualhost