フレンドリーなURLをApacheからnginxに移動すると問題が発生します。フレンドリーURLは、サブディレクトリsgforum内でのみ動作します。nginx - フレンドリーなURLがディレクトリ
はPHPで、私はとアドレスを受信します。127.0.0.1/sgforum/index、127.0.0.1/sgforum/memberなど
私は 127.0.0.1に行く/sgforum/ - それは動作しますが、私はメンバー(127.0.0.1/sgforum/member)、またはインデックスを与えるとき、それはファイルをダウンロード私のコンピュータに、phpで開くのではなく、
これは私のの/ etc/nginxの/サイト利用可能/デフォルトファイル:あなたはメンバーフォルダの場所を設定する必要が
server {
listen 80 default_server;
#listen [::]:80 default_server;
root /home/ariel/workspace;
index index.php index.html;
server_name _;
location/{
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
# FRIENDLY URLS
location /sgforum/ {
if (!-e $request_filename){
rewrite ^/sgforum/(.*)$ /sgforum/index.php break;
}
}
location ~ /\.ht {
deny all;
}
}
member - ディレクトリではなく、PHP $ _SERVER ['REQUEST_URI']で答えて特定のアクションを選択する引数です。 – arielum
ファイルをダウンロードしたときには、php-fpmの設定を調整する必要があることを意味します。 –
@MeiramChuzhenbayev、両方の回答を徹底的に投稿できますか? –