2016-04-02 12 views
0

私はLaravel 5.2でWebサイトを構築しています。最初からフォーラムを構築するのではなく、SMFのようなものをインストールしたいと考えています。Laravelと一緒に他のアプリケーションをインストールするにはどうすればよいですか?

Laravelは現在私のWebサーバーのルートディレクトリにありますので、SMFをフォルダにインストールしたい場合はそこに保管しておきます。例えば

www.example.com/smf

私はLaravelの/publicフォルダにインストールすることを考えていますが、私は彼らがお互いに競合します怖いです。 /publicフォルダはSMFをインストールするための正しい場所ですか、SMFフォルダを指すルートを使用する必要がありますか?

サーバー:あなたのSMFのインストールにwww.example.com/smfをリダイレクトするためにnginxのを使用することができLaravelフォージ

+0

あなたのウェブサイトをホストするために何を使用していますか? (Apache、Nginxなど) – Nasreddine

+0

@Nasreddine私はDigital OceanをForgeで使用しているので、Nginxだと確信しています。 – ProEvilz

+1

あなたのためにバックアップをとっておいてください。 Dir。パブリックHTMLフォルダのララベルアプリケーションには影響しません – Abhishek

答えて

1

あなたは、フォルダ(複数可)あなたは前Laravel関連規則を使用するためにカスタムルールを追加する必要があります。サンプルnginx config file here探してください

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; 
} 

1

経由D.O滴。そのためには、あなたの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の専門家ではないと言わなければなりません。
関連する問題