nginx 配置 支持 index.php/login方法

nginx 配置 支持 index.php/login类似方法

server {

    listen       80;
    server_name  localhost;


    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;
        root   /usr/share/nginx/html;
    location / {
        root   /usr/share/nginx/html;
        index index.php  index.html index.htm ;
    }


    error_page  404              /404.html;


    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }


location ~ \.php/ {
   if ($request_uri ~ ^(.+\.php)(/.+?)($|\?)) { }
   fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
   include fastcgi_params;
   fastcgi_param SCRIPT_NAME     $1;
   fastcgi_param PATH_INFO       $2;
   fastcgi_param SCRIPT_FILENAME $document_root$1;
}
location ~ \.php$ {
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny  all;
    }
}

你可能感兴趣的:(Linux上服务器)