Skocz do zawartości

felek1

Użytkownicy
  • Zawartość

    7
  • Rejestracja

  • Ostatnio

Posty napisane przez felek1


  1. Jak zrobić, żeby ustawienia zadziałały na całym folderze "folder"??

     

    location = /folder/test.php
    {
    root /usr/share/nginx/www;

    allow all;

    #przypominamy że to plik PHP i należy go przetworzyć..

    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;

     

    }


  2. Hej

     

    Mam pewien problem z konfoguracją kulku strona jednym nginx tak zeby przekierowanie bylo:

    domena1.pl -> usr/share/nginx/www/domena1.pl

    domena2.pl -> usr/share/nginx/www/domena2.pl

    domena3.pl -> usr/share/nginx/www/domena3.pl

    domena4.pl -> usr/share/nginx/www/domena4.pl

     

     

    Mój plik /etc/nginx/sites-enabled/domena1.pl

    server {
        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default_server ipv6only=on; ## listen for ipv6
    
        root /usr/share/nginx/www/domena1.pl;
        index index.html index.htm;
    
        # Make site accessible from http://localhost/
        server_name domena1.pl www.domena1.pl;
    
        location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ /index.html;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
        }
    
        location /doc/ {
            alias /usr/share/doc/;
            autoindex on;
            allow 127.0.0.1;
            allow ::1;
            deny all;
        }
    
    }

    Mój plik /etc/nginx/sites-enabled/domena2.pl

    server {
        listen   80;
        listen [::]:80;
    
        root /usr/share/nginx/www/domena2.pl;
        index index.html index.htm;
    
        # Make site accessible from http://localhost/
        server_name domena2.pl www.domena2.pl;
    
        location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ /index.html;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
        }
    
        location /doc/ {
            alias /usr/share/doc/;
            autoindex on;
            allow 127.0.0.1;
            allow ::1;
            deny all;
        }
    
    }

    Oczywiście po wszystkim restart itp.

     

     

    Czy coś robię źle????


  3. Ok. teraz juz działa :)

    Mój plik jest już chyba napisany poprawnie i zmieniłem roota tylko w klamrach location.

    Jeszcze nie wiem czy działa charset windows-1251 bo nie wiem jak to sprawdzić, ale myślę, że powinno być okej :)

    server {
     
        index index.php index.html index.htm;
        #listen   80; ## listen for ipv4; this line is default and implied
        #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6
     
    #Make site accessible from http://localhost/
        server_name localhost;
     
        location / {
    root /usr/share/nginx/www;
    auth_basic  "AUTH";
    auth_basic_user_file /etc/nginx/.htpasswd;
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ /index.html;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
    location ~ \.php$ {
    root /usr/share/nginx/www;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
     
    if ($http_user_agent !~* "XXX2") {
    return 444;
    }
    }
    location ~ /folder {
    root /usr/share/nginx/www;
    charset windows-1251;
    autoindex on;
    }
     
        }

  4. Co do Useragent to strona mi się ładuje nawet jak wchodzę z chrome, explorera itp. A mam wtyczke do firefoxa w której sam sobie ustawiam USERAGENTA np. XXUserAgent

    server {
        #listen   80; ## listen for ipv4; this line is default and implied
        #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6
     
        root /usr/share/nginx/www;
        index index.php index.html index.htm;
     
        # Make site accessible from http://localhost/
        server_name localhost;
     
        location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ /index.html;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
     
    location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    }
    
    location / {
    auth_basic  "AUTH";
    auth_basic_user_file /etc/nginx/.htpasswd;
    }
    location ~ /folder {
    root /usr/share/nginx/www;
    charset windows-1251;
    autoindex on;
    }
    
    if ($http_user_agent !~* "XXUserAgent") {
    return 444;
    }
     
        }
    

  5. Ma ktoś pomysł jak to napisać?

     

    AUTH działa po wpisaniu domena.pl, ale domena.pl/test.php już nie krzyczy o hasło i plik się normalnie uruchamia :(

     

    Komenda USERAGENT blokuje danego useragenta a mi zależy, żeby blokowało wszystkich useragentów oprócz "XXUserAgent"

    location / {
    auth_basic  "AUTH";
    auth_basic_user_file /etc/nginx/passwd;
    }
    location ~ /folder {
    root /usr/share/nginx/www;
    charset windows-1251;
    autoindex on;
    }
    
    if ($http_user_agent !~* "XXUserAgent") {
    return 444;
    }

  6. Niestety kod nie jest do końca taki jakiego się spodziewałem :(

     

    AUTH działa po wpisaniu domena.pl, ale domena.pl/test.php już nie krzyczy o hasło i plik się normalnie uruchamia :(

    Komenda USERAGENT blokuje danego useragenta a mi zależy, żeby blokowało wszystkich useragentów oprócz "XXUserAgent"

     

    location / {
    auth_basic "AUTH";
    auth_basic_user_file /etc/nginx/passwd;
    }

    location ~ /folder {
    root /usr/share/nginx/www;
    charset windows-1251;
    autoindex on;
    }

    if ($http_user_agent !~* "XXUserAgent") {
    return 444;
    }


  7. Szukam osoby która mi napisze taki kod.

    Wymagania:

    - blokowanie wszystkich robotów dal całej strony(tj.google,yahoo itp.)

    - cała strona na hasło AuthName

    - dostęp do całej strony tylko dla wybranego useragenta np. XXX2

    - dodanie jeszcze dla wybranego folderu:

    "AddDefaultCharset windows-1251
    Options -Indexes"

    Proszę o PW z ofertami cenowymi.

×