nginx alias+location directive

后端 未结 2 1392
挽巷
挽巷 2021-02-08 11:23
server {
    listen      80;
    server_name  pwta; 
    root html;

    location /test/{
        alias html/test/;
        autoindex on;
    }
    location ~ \\.php$ {
         


        
2条回答
  •  星月不相逢
    2021-02-08 12:17

    nginx alias

        server {
        listen      80;
        server_name  pwta;
        index index.html index.php;
        root html;
    
        location /testpath/ {
            alias html/test/;
        }
        location ~  ^/testpath/(.+\.php)$ { ### This location block was the solution
            alias html/test/;     
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$1;
            include fastcgi_params;
        }
         location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    

提交回复
热议问题