Heim  >  Fragen und Antworten  >  Hauptteil

Problem beim Festlegen des virtuellen Verzeichnisses in Nginx?

server {
        listen       80;
        server_name  localhost;
    index index.html index.htm index.php;
    root /alidata;
    location ~ .*\.(php|php5)?$
    {
        #fastcgi_pass  unix:/tmp/php-cgi.sock;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires 30d;
    }
    location ~ .*\.(js|css)?$
    {
        expires 1h;
    }
    location / {
     if (!-e $request_filename)
     {
         rewrite (.*) /index.php;
     }
   }
}

Ich bin jetzt root /alidata; das heißt, ich zeige auf das Root-Verzeichnis unter alidata.

Wie stelle ich es ein, wenn es nur auf zwei /alidata/A und /alidata/B zeigt?

ringa_leeringa_lee2713 Tage vor337

Antworte allen(1)Ich werde antworten

  • PHP中文网

    PHP中文网2017-05-16 17:18:45

    你可以给每个location添加正则来匹配A和B,比如 location/(A|B)/代替~

    Antwort
    0
  • StornierenAntwort