3

いくつかの VPS (cPanel を使用した友人の apache サーバー) にアカウントがあり、そこに public_html ディレクトリが 1 つあります。約 5 ~ 6 個の Web サイトがあります。

/home/myusername/public_html/domain-1.name/index.php
/home/myusername/public_html/domain-2.name/index.php

しかし、私はこの方法が好きではありません。私はそれをより良く組織化して、各 Web サイトごとにいくつかのものを分離して分離できるようにしたいと考えています。では、次のように作成するとどうなるでしょうか。

/home/myusername/websites/domain-1.name/public_html/index.php

/home/myusername/websites/domain-2.name/public_html/index.php and so on

Web ディレクトリを構造化する正しい方法でしょうか? そして、Apacheはそのように機能しますか?おそらく、他の慣習や一般的な回避策がいくつかありますか?

ありがとう

4

3 に答える 3

1

さて、私は結論を出し、私が行った方法の概要を説明したいと思います。
アイデアをくれた@bikeshedderに感謝します!

そのため、Linux VPSサーバーで単一のアカウント(ルートなし)/home/myusername/を使用しているため、既存のディレクトリ構造から完全に抽象化する必要はありませんでしたが、同時に、クライアントとそのスペースを分離して分離するための適切な環境を作成したいと思いました。

主な目標は次
のとおりです。*新しいディレクトリ構造は、すべてのファイルとフォルダを適切で明確な順序に保つのに役立つはずです。
*ナビゲートと閲覧が簡単です。
*各開発者またはクライアントは、自分のスペースにのみアクセスできます。

構造:

/home/myusername/http/client-1/domain-1/public_html/index.php
/home/myusername/http/client-1/domain-1/resources/
/home/myusername/http/client-1/domain-1/configuration.php
/home/myusername/http/client-1/domain-2/public_html/index.php
/home/myusername/http/client-1/client's_resource_dir/  

/home/myusername/http/client-2/domain-3/public_html/index.php
/home/myusername/http/client-2/domain-3/subdomain/public_html/index.php

結果:
*クライアントのスペースとドメインスペースを分離しました。これにより、あらゆるタイプのWebプロジェクトに十分なスペースが確保されます。
*ファイルとディレクトリが他のプロジェクト、ドメイン、クライアントと混同されることはなくなりました。
*サブドメインパスの場合、要件またはサブドメインWebサイトのサイズに応じて、サブ
ディレクトリとして、/domain-3.name/subdomain/public_html/
または追加のサブドメインディレクトリにすることができます。 * Public_htmlは、各Webサイト のDocumentRootになります。/subdomain.domain-3.name/public_html/

私は行きませんでした、srv/そしてvar/www私にはそれはサーバーのサーバーのように聞こえます、そしてまた私はvar/現在のセットアップの可変データがウェブのものに該当するとは感じません。
近日公開予定のローカルWeb/ファイル共有サーバーには意味があるかもしれませんが

しかし、ここで別の質問
があります。cPanelのデフォルトパスとして新しいパスを指定するにはどうすればよいですか?そして私のユーザーだけのために?
これで、1つのユーザースペースに複数のDocumentRootディレクトリが作成されます。
それはApacheの設計で可能ですか?
私は新しい質問を作成したほうがいいです:)そして答えで私の質問を編集します

どんな提案も歓迎します!

于 2013-01-29T15:25:35.400 に答える
1

これはまったく問題ありません。実際、一般的な Web アプリケーションには、パブリックにアクセスできないデータ (構成ファイル、管理スクリプト、バージョン管理ファイルなど) も含まれているため、ドメイン フォルダーをドキュメント ルートとして使用しないことを強くお勧めします。

個人的には名前の方が好きでhtdocs、サイトを下に置いています/srv/http

例えば:

/srv/http/user1/domain1/htdocs/
/srv/http/user1/domain2/htdocs/
/srv/http/user1/domain3/htdocs/
/srv/http/user2/domain4/htdocs/
/srv/http/user3/domain5/htdocs/

こうすることで、 をディレクトリに設定しDocumentRoothtdocsドメイン ディレクトリの別のサブ ディレクトリにある Web サーバーによって配信されることを意図していないその他のものを配置できます。

于 2013-01-28T22:18:46.917 に答える
0

通常は、コンテンツ、トラフィックの複雑さ、より専用の仮想サーバーまたはベア メタル サーバー/インスタンスへの今後の移行戦略の認識に応じて、5 ~ 30++ のサイトから一度ホスティングします。

/<node-serial-or-hostname-or-domain>/<@|subdomain|www|others>/index.<html|php|jsp|aspx|what-not>
/<node-serial-or-hostname-or-domain>/<@|subdomain|www|others>/assets/...

/<node-serial-or-hostname-or-domain>/<@|subdomain|www|others>/index.<html|php|jsp|aspx|what-not>
/<node-serial-or-hostname-or-domain>/<@|subdomain|www|others>/assets/...

/<node-serial-or-hostname-or-domain>/<@|subdomain|www|others>/index.<html|php|jsp|aspx|what-not>
/<node-serial-or-hostname-or-domain>/<@|subdomain|www|others>/assets/...

/<node-serial-or-hostname-or-domain>/<@|subdomain|www|others>/index.<html|php|jsp|aspx|what-not>
/<node-serial-or-hostname-or-domain>/<@|subdomain|www|others>/assets/...

/<node-serial-or-hostname-or-domain>/<@|subdomain|www|others>/index.<html|php|jsp|aspx|what-not>
/<node-serial-or-hostname-or-domain>/<@|subdomain|www|others>/assets/...
于 2017-05-13T08:03:52.923 に答える