0

Laravel 5.2 で Web サイトを構築していますが、フォーラムをゼロから構築するのではなく、SMFなどのフォーラムをインストールしたいと考えています。

Laravel は現在、Web サーバーのルート ディレクトリにあり、SMF をフォルダーにインストールしたいので、そこに保持したいと考えています。

例えば:www.example.com/smf

Laravelのフォルダにインストールしようと思ってい/publicますが、競合するのではないかと心配です。フォルダは SMF をインストールする正しい場所ですか/public? SMF フォルダを指すルートを使用する必要がありますか?

サーバー: Laravel Forge 経由の DO ドロップレット

4

2 に答える 2

1

Nginx を使用www.example.com/smfして、SMF インストールにリダイレクトできます。これを行うには、これをserverブロックに追加します。

location /smf {
    # nginx will concatenate the string above with the root value
    # so your SMF files should be in "/path/to/smf/parent/dir/smf".
    # Make sure that Nginx can access them.
    root "/path/to/smf/parent/dir";

    # change this config to suit your needs
    index  index.php index.html index.htm;

    location ~ \.php$ {

        # Here use the same config from the server block that allows you
        # to execute PHP scripts
        fastcgi_pass   127.0.0.1:9123;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

いくつか追加する必要があります。

  • それらを編集する前に、設定ファイルをバックアップしてください。
  • 上記のコードを試してみましたが (私のマシンでも動作します™)、私は Nginx の専門家ではないと言わざるを得ません。
于 2016-04-02T20:30:52.490 に答える
1

Laravel 関連のルールのに、使用するフォルダーのカスタム ルールを追加する必要があります。

location /smf/index.php(/.*)?$ {        
    fastcgi_split_path_info ^(/smf/index.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_read_timeout 1000;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    include fastcgi_params;
}
location /smf/ { 
    if (!-e $request_filename) {
            rewrite ^.*$ /smf/index.php last;    
        }
    try_files $uri $uri/ smf/index.php?args; 
}

サンプルのnginx 設定ファイルはこちらで探してください。

于 2016-04-03T03:57:08.740 に答える