2016-04-10 2 views
0

私は自分のウェブサイトの統計ページを持っています。Nginxリライトダウンロードファイル

User types: sub.mydomain/u/Username 
End result: sub.mydomain/stats.php?player=Username 

I want the end result to still show sub.domain/u/Username 

しかし、phpファイルがダウンロードされたようですが、これは私のデータベース情報が含まれているため、大きな問題です。私はphp-fpmと一緒にインストールされたPhpでCentos 6を使用しています。私はしかし、他の人の質問と回答を読んだことがある、これは私の問題を解決していないよう

location ~ \.php$ { 
     try_files $uri =404; 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     include fastcgi_params; 
     fastcgi_pass unix:/var/run/php5-fpm.sock; 
    } 
} 

server { 
    listen 80; 
    server_name stats.mydomain; 

    root /var/www/mydomain/public_html/stats/; 

    location/{ 
     proxy_pass http://mydomain/stats/home.php; 
    } 
    location /u { 
    rewrite ^/u/(.*)$ /stats.php?player=$1 last; 
    } 
} 

は、ここに私ののvirtual.confファイルです。

ありがとうございました!

答えて

0

location ~ php ...ブロックが別のサーバーブロックにあるようです。あなたのstats.mydomainに影響を与えるには、これはserver中かっこの中にある必要があります。

+0

Omg!どうもありがとうございました! – Chazmondo